Fluent Ribbon Control Suite

Topics: Conventions
May 20, 2011 at 7:28 PM

I always used the build in WPF controls with CM and really liked the conventions (SayHello, CanSayHello etc.)
Now I want to use Fluent Ribbon http://fluent.codeplex.com/ for a new project but the conventions are not working on this control.

ShellView.xaml

<Fluent:Ribbon>
    <!--Tabs-->
    <Fluent:RibbonTabItem Header="Home">
        <Fluent:RibbonGroupBox Header="Group1">
            <Fluent:Button 
                x:Name="HelloCaliburn" 
                Header="Hello Caliburn!"
                LargeIcon="Images\GreenLarge.png" />
        </Fluent:RibbonGroupBox>
    </Fluent:RibbonTabItem>
</Fluent:Ribbon>
ShellViewModel.cs
public void HelloCaliburn()
{
       MessageBox.Show("Hello Caliburn!");
}

I tried to add this to the conventionmanager but it is not working

ConventionManager.AddElementConvention<Fluent.Button>(Fluent.Button.ContentProperty, "DataContext", "Click");

 

Any suggestions (without changing the xaml)?

sample project link:  http://www.mwsoft.nl/tmp/Caliburn.Micro.HelloFluent.zip

May 23, 2011 at 1:11 PM

Hey,

you actually don't need to add the convention because the Fluent.Button inherits from ButtonBase for a which convention already exists. The problem is, that the (named) button cannot be located by the BindingScope. The BindingScope basically traverses the visual tree of the RibbonWindow and searches for named elements. But if you invoke VisualTreeHelper.GetChildrenCount() on the Fluent.Ribbon it returns 0 and the named button is never found (set a breakpoint in the BindingScope class at line 92 to see it). I don't know if thats a bug oder intended by the ribbon but that is the readon why the convention binding doesn't work

Coordinator
May 23, 2011 at 1:52 PM

kmees is correct. If you want to get this working, you would need to alter how the BindingScope locates elements so that it could detect the Ribbon and find the buttons in its groups.

Feb 13, 2013 at 11:15 AM
Edited Feb 13, 2013 at 11:22 AM
I hope this helps:
Using Fluent Ribbon with Caliburn.Micro
It's work for me.