I'm using a Ribbon control from RibbonControlLibrary for .net 3.5.
I can't use RibbonWindow
for some presentation-compatibility issues. So I place a Ribbon control inside Window
.
There are no visible issues, but I'm getting 2 error messages in my VisualStudio output window.
Those messages are:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Microsoft.Windows.Controls.Ribbon.RibbonWindow', AncestorLevel='1''. BindingExpression:Path=WindowState; DataItem=null; target element is 'Ribbon' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Microsoft.Windows.Controls.Ribbon.RibbonWindow', AncestorLevel='1''. BindingExpression:Path=IsActive; DataItem=null; target element is 'Ribbon' (Name=''); target property is 'NoTarget' (type 'Object')
This can be reproduced just adding a Ribbon
to a Window
and running the application.
Is there a way to tell Ribbon not to try to bind anything exactly to RibbonWindow but for Window?
Since you said you can't use RibbonWindow (for some reason...), I am assuming you're doing something like
<Window x:Class="Yournamespace" ...>
<Ribbon>
</Ribbon>
</Window>
Your ancestor should be
AncestorType='System.Windows.Window'
and not 'Microsoft.Windows.Controls.Ribbon.RibbonWindow'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With