2015-01-14 82 views
1

全部, 我看到下面在我的輸出窗口中綁定警告。有人可以解釋一下在這裏綁定有什麼問題。我在我的ViewModel中爲ProgressValue'設置了一些值。但是,如下所示,僅爲「ProgressValue」設置了最終值100。WPF綁定警告

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}" 
      /> 

在我的視圖模型中,我更新瞭如下所示的值。

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

您應該顯示一些代碼。 –

+0

代碼在哪裏?您只需複製輸出窗口。 –

+2

這些都不是錯誤。我甚至不知道他們是警告,看起來更像是日誌。 – BradleyDotNET

回答

0

BradleyDotNET是對的。

您已將PresentationTraceSources.TraceLevel設置爲高。這將導致大量的信息打印有關綁定。

MSDN on PresentationTraceSources.TraceLevel

+0

我明白這一點。如果您發現上述代碼存在任何問題,您是否可以告訴我。爲什麼ProgressBar不會更新? – codematrix

+0

哦,對不起。我誤解了。什麼'類型'是pMeter? – savetruman

+0

您可以在代理中將pMeter的值打印到控制檯,以確保該操作實際上經常得到足夠的調用嗎? – savetruman