Fluent.Ribbon icon indicating copy to clipboard operation
Fluent.Ribbon copied to clipboard

Cannot find source for binding: BindingExpression:Path=TitleBar.ActualHeight in Page

Open joergahmann opened this issue 1 year ago • 2 comments

Binding-Errors with ribbon on page

**I have an Hamburger-App build with the template studio, in some Pages (not in the shell-window) I'm using a fluent.ribbon, which work fine. But I still get those annoying xaml-Errors for each Page:

System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Fluent.IRibbonWindow', AncestorLevel='1''. BindingExpression:Path=TitleBar.ActualHeight; DataItem=null; target element is 'Ribbon' (Name=''); target property is 'QuickAccessToolBarHeight' (type 'Double')

System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Fluent.IRibbonWindow', AncestorLevel='1''. BindingExpression:Path=TitleBar; DataItem=null; target element is 'Ribbon' (Name=''); target property is 'TitleBar' (type 'RibbonTitleBar')

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=Background; DataItem=null; target element is 'QuickAccessToolBar' (Name='PART_QuickAccessToolBar'); target property is 'Background' (type 'Brush')

I know, I#m using a page, and fluent.ribbon needs a window, but is there chance to get rid off those warnings?**

best regards

Win11(64)

  • Fluent.Ribbon 11.0.0-alpha0235
  • Windows 11(64)
  • <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>

joergahmann avatar Jul 18 '24 18:07 joergahmann

Hi there. Fluent.Ribbon doesn't need a window, but it's designed around the assumption that there is a window available. ;-)

To get rid of those warnings you can either set QuickAccessToolBarHeight and TitleBar on your Ribbon instance, or create a new style that is based on Fluent.Ribbon.Styles.Ribbon and set those values there. QuickAccessToolBarHeight has a default value of 23. TitleBar can be set to {x:Null}.

To get rid of the last warning you can override the style Fluent.Ribbon.Styles.QuickAccessToolbar and set the Background property there. This one will not be required starting with version 11 as i just removed it from the style as it wasn't required anyway.

batzen avatar Jul 23 '24 14:07 batzen

Thanks a lot, I will try as soon I'm back home

joergahmann avatar Jul 23 '24 16:07 joergahmann