Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding failures from within RibbonTabItem on IsMinimized & IsOpen #1035

Closed
DaveInCaz opened this issue Jun 10, 2022 · 1 comment
Closed

Comments

@DaveInCaz
Copy link

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:

image
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:

image

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
@batzen batzen self-assigned this Jun 11, 2022
@batzen batzen added this to the 10.0 milestone Jun 11, 2022
@batzen batzen closed this as completed in 294010b Jun 11, 2022
@DaveInCaz
Copy link
Author

@batzen thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants