c# - WPF 绑定(bind)警告

标签 c# wpf

全部, 我在“输出”窗口中看到以下绑定(bind)警告。有人可以在这里解释 Binding 的问题吗?我在我的 ViewModel 中为 ProgressValue' 设置了几个值。但仅为“ProgressValue”设置最终值 100,如下所示。

System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 95 : BindingExpression (hash=58496944): Got PropertyChanged event from ExportControls (hash=6385044)
System.Windows.Data Warning: 101 : BindingExpression (hash=58496944): GetValue at level 0 from ExportControls (hash=6385044) using RuntimePropertyInfo(ProgressValue): '100'
System.Windows.Data Warning: 80 : BindingExpression (hash=58496944): TransferValue - got raw value '100'
System.Windows.Data Warning: 89 : BindingExpression (hash=58496944): TransferValue - using final value '100'

我的代码如下所示。它在 Styles.xaml 中定义。

<ProgressBar IsIndeterminate="False" 
             Value="{Binding ProgressValue, 
                     UpdateSourceTrigger=PropertyChanged, 
                     Mode=TwoWay, 
                     diag:PresentationTraceSources.TraceLevel=High}"
             x:Name="ExportProgressBar"
             Visibility="Collapsed"
             VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
             Background="Transparent"
             BorderThickness="0"
             Foreground="{StaticResource HighlightBlueBrush}"
             />

在我的 View 模型中,我更新了如下所示的值。

                Dispatcher.CurrentDispatcher.Invoke(new Action(() =>
                {
                    export.ProgressValue = pMeter;
                }));

最佳答案

BradleyDotNET 是对的。

您已将 PresentationTraceSources.TraceLevel 设置为高。这将导致打印有关绑定(bind)的大量信息。

MSDN on PresentationTraceSources.TraceLevel

关于c# - WPF 绑定(bind)警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27950605/

相关文章:

c# - 这段代码是合适的 MVC 架构吗?

c# - 如何通过加密生成有效的文件夹名称

c# - 在 WCF 中自然排序 IQueryable 字符串

c# - 如何有一个下拉列表显示两列但选择只显示一列的组合框?

c# - WPF 将 RichTextBox 打印为图像

c# - Google Drive - 如何从代码中清空垃圾(以编程方式)?

c# - 在 C# 中向 Windows 8 Metro 风格应用程序发送推送通知

c# - 找不到绑定(bind)源

WPF 数据绑定(bind)标签设计时文本

wpf - Adobe flex 或 WPF 编写视觉效果丰富的桌面应用程序