c# - 仅在发行版中存在 UWP 绑定问题
问题描述
我的 UWP 应用程序中的数据绑定存在问题。我有一个有属性的类。
Public Class Settings
Implements INotifyPropertyChanged
Private _EditorFont As String
Private _IsDirty As Boolean = False
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Event Dirtied As EventHandler
Public Property EditorFont As String
Get
Return _EditorFont
End Get
Set(value As String)
If value <> _EditorFont Then
_EditorFont = value
RaisePropertyChanged(NameOf(EditorFont))
MakeDirty()
End If
End Set
End Property
Protected Sub RaisePropertyChanged(ByVal Name As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(Name))
End Sub
Protected Overridable Sub OnDirtied(ByVal e As EventArgs) Implements ISaveable.OnDirtied
RaiseEvent Dirtied(Me, e)
End Sub
Public Sub MakeDirty()
If IsDirty = False Then
IsDirty = True
OnDirtied(EventArgs.Empty)
End If
End Sub
End Class
我还有一个 RichEditBox 控件,它将字体系列绑定到我的类的属性:
<RichEditBox Grid.Column="1" Grid.Row="0" AcceptsReturn="True" Padding="5,10,5,5" x:Name="Editor"
TextChanged="Editor_TextChanged" FontFamily="{x:Bind Settings.EditorFont, Mode=OneWay}"
SelectionChanged="Editor_SelectionChanged"
Loaded="Editor_Loaded" PreviewKeyDown="TextBox_KeyDown" />
问题是我的绑定在调试模式下运行应用程序时似乎工作正常,但在发布模式下运行时无法工作。我不知道该怎么做才能解决这个问题,而且在找到其他有同样问题的人方面我有点茫然。有人有想法吗?
解决方案
推荐阅读
- javascript - 外部功能在页面加载时不起作用,但在按钮按下时起作用
- android - Android,将底部导航与标签相结合(活动与片段)
- html - 在 ":hover" 之后有一个元素停留在结束动画位置吗?
- python - 哪个更快;添加到 pandas 数据框,然后提取到 cvs 或使用文件指针写入文档
- php - 如何循环乘法?
- python - 重塑和过滤熊猫数据框
- aws-lambda - 仅在特定 lambda 请求时才允许完成 cognito AWS API 操作
- c - 使用 qsort 和 void 指针问题对结构进行排序
- node.js - 来自数据库的 HTML 显示为纯文本
- php - Yii2. 无法存储 url 或“