-
-
Notifications
You must be signed in to change notification settings - Fork 528
Description
My app gets several binding errors which seem to originate within Fluent RibbonTabItem
objects when the RibbonWindow
first loads:
Warning 1 null IsMinimized GeneralTabItem.IsMinimized, Name='GeneralTab' Boolean
Cannot find source: RelativeSource FindAncestor, AncestorType='Fluent.RibbonTabControl', AncestorLevel='1'.
Warning 1 null IsDropDownOpen GeneralTabItem.IsOpen, Name='GeneralTab' Boolean
Cannot find source: RelativeSource FindAncestor, AncestorType='Fluent.RibbonTabControl', AncestorLevel='1'.
(from the XAML binding failures pane in Visual Studio)
Here the class GeneralTabItem
is derived from RibbonTabItem
, and I have several like this all of which come up with those same two binding errors. The ribbon seems to be setup similar to examples I have seen, like so:
I think these errors originate from the following lines in \Fluent.Ribbon-develop\Fluent.Ribbon-develop\Fluent.Ribbon\Themes\Controls\RibbonTabItem.xaml
(lines 147-148):
<Setter Property="IsMinimized" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonTabControl}}, Path=IsMinimized, Mode=OneWay, FallbackValue=False}" />
<Setter Property="IsOpen" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonTabControl}}, Path=IsDropDownOpen, Mode=OneWay, FallbackValue=True}" />
I looked in Snoop (amazing tool BTW) to see what I could find out, and it shows this for those properties:
And I can also see that the Style
property for these RibbonTabItem objects has a blank value with value source set to Default
.
I checked the tree, and indeed it does seem like there is the expected relationship where all the RibbonTabItem (derived) object DO have a RibbonTabControl
ancestor:
So its not obvious why the bindings are failing. But if I manually add:
IsOpen="True"
IsMinimized="False"
to each RibbonTabItem
that does suppress the issue.
I've found an older similar issue here as well, but it seemed to have a different cause (Ribbon was not in the visual tree - not the case here).
I have tried to create a minimal reproduction but so far have not been able to get it to reproduce outside of my own app, unfortunately. But if anyone can suggest further debugging steps I can do my best to find out whatever additional information might help to diagnose this.
Potentially weird detail: The ribbon window is not the main window of the application. In fact it is a child window spawned from a native (VB6) process. But we haven't had any widespread issues like this, so I'm not sure that is relevant. The visual tree seems complete from ribbon tab item all the way up to the App
object.
Environment
I'm using Fluent.Ribbon from Nuget version 9.0.4; although this also occurred under 8.0.3.
- Windows 10 (10.0.19044 Build 19044)
- .NET Framework 4.7.2