MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.3k stars 2.45k forks source link

Binding issues dialogwindow #3845

Closed Uvidus closed 4 years ago

Uvidus commented 4 years ago

Hello folks, First of all congrats with getting v2.0 out and also a big thanks for all your work and effords. I think they really paid off!

Anyway I might have stumbled upon a very small 'bug', which perhaps has not yet been brought under your attention yet...

Describe the bug

Upon opening a dialogwindow (messagedialog, inputdialog etc) I get a sporadic binding errors (info) shown in the debugger (using 4.5.2 .NET framework), as per below.

Steps to reproduce

Demo app also shows these sporadiablly (at least the one in combination with .NET 4.5.2)

Expected behavior

No bindingerrors occurring

Actual behavior

System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=DialogMessageFontSize; DataItem=null; target element is 'TextBlock' (Name='PART_MessageTextBlock'); target property is 'FontSize' (type 'Double')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=Foreground; DataItem=null; target element is 'TextBlock' (Name='PART_MessageTextBlock'); target property is 'Foreground' (type 'Brush')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=Message; DataItem=null; target element is 'TextBlock' (Name='PART_MessageTextBlock'); target property is 'Text' (type 'String')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=AffirmativeButtonText; DataItem=null; target element is 'Button' (Name='PART_AffirmativeButton'); target property is 'Content' (type 'Object')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=DialogButtonFontSize; DataItem=null; target element is 'Button' (Name='PART_AffirmativeButton'); target property is 'FontSize' (type 'Double')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=NegativeButtonText; DataItem=null; target element is 'Button' (Name='PART_NegativeButton'); target property is 'Content' (type 'Object')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=DialogButtonFontSize; DataItem=null; target element is 'Button' (Name='PART_NegativeButton'); target property is 'FontSize' (type 'Double')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=FirstAuxiliaryButtonText; DataItem=null; target element is 'Button' (Name='PART_FirstAuxiliaryButton'); target property is 'Content' (type 'Object')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=DialogButtonFontSize; DataItem=null; target element is 'Button' (Name='PART_FirstAuxiliaryButton'); target property is 'FontSize' (type 'Double')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=SecondAuxiliaryButtonText; DataItem=null; target element is 'Button' (Name='PART_SecondAuxiliaryButton'); target property is 'Content' (type 'Object')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=DialogButtonFontSize; DataItem=null; target element is 'Button' (Name='PART_SecondAuxiliaryButton'); target property is 'FontSize' (type 'Double')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'EditorMenuItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'EditorMenuItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'EditorMenuItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'EditorMenuItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'EditorMenuItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')\
System.Windows.Data Information: 10 : 
Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'EditorMenuItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')

Environment

MahApps.Metro version: v2.0.1
Windows build number: Win10 1909 [Version 10.0.18363.836]
Visual Studio: 2015 & 2019
Target Framework: .NET 4.5.2
punker76 commented 4 years ago

@Uvidus These BindingExpression System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. are informational, and should not affect the application performance or something else. If you look at the WPF source then you can see that the binding will use the default value from the target property (that's what the message says).

BindingExpressionBase

https://github.com/dotnet/wpf/blob/6d6165997ba030733fd04ac2ff7fe70db0689eac/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingExpressionBase.cs#L1565-L1577

https://github.com/dotnet/wpf/blob/6d6165997ba030733fd04ac2ff7fe70db0689eac/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingExpressionBase.cs#L819-L834