lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.04k stars 667 forks source link

Fixed MouseOverButtonsForeground binding for the default TitleBarButon style #1040

Closed syntax-tm closed 2 months ago

syntax-tm commented 3 months ago

The binding for the TitleBarButton's MouseOverButtonForeground is incorrect shows the following error in output:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Wpf.Ui.Controls.TitleBarButton', AncestorLevel='1''. BindingExpression:Path=MouseOverButtonsForeground; DataItem=null; target element is 'TitleBarButton' (Name='PART_HelpButton'); target property is 'MouseOverButtonsForeground' (type 'Brush')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Wpf.Ui.Controls.TitleBarButton', AncestorLevel='1''. BindingExpression:Path=MouseOverButtonsForeground; DataItem=null; target element is 'TitleBarButton' (Name='PART_MinimizeButton'); target property is 'MouseOverButtonsForeground' (type 'Brush')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Wpf.Ui.Controls.TitleBarButton', AncestorLevel='1''. BindingExpression:Path=MouseOverButtonsForeground; DataItem=null; target element is 'TitleBarButton' (Name='PART_MaximizeButton'); target property is 'MouseOverButtonsForeground' (type 'Brush')

Pull request type

Please check the type of change your PR introduces:

What is the current behavior?

Current behavior is that the binding does not work.

Issue Number: N/A

What is the new behavior?

The property binding is now successful with no errors in output.

Other information

Minor change. Have been busy but created a new project and saw this error in the output window and figured I'd just fix it really quick.

As always let me know if you have any questions but this is pretty straightforward since MouseOverButtonsForeground is a property of the TitleBarButton itself and not the TitleBar so the RelativeSource just needed to be set to Self.