Skip to content

Conversation

@syntax-tm
Copy link
Contributor

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:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

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.

@syntax-tm syntax-tm requested a review from pomianowski as a code owner April 7, 2024 15:41
@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request release labels Apr 7, 2024
@pomianowski pomianowski self-assigned this Apr 14, 2024
@pomianowski pomianowski changed the base branch from main to development April 14, 2024 08:16
@pomianowski pomianowski merged commit 7652db2 into lepoco:development Apr 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

controls Changes to the appearance or logic of custom controls. PR Pull request release styles Topic is related to styles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants