Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > RibbonView > How to specify group variants when using MVVM

Not answered How to specify group variants when using MVVM

Feed from this thread
  • Stephan Intermediate avatar

    Posted on Sep 15, 2011 (permalink)

    Hi,

    I want my buttons in the ribbon view to resize according to the available space. I can achieve what I want by specifying the three variants on the ribbon group like this:

    <Telerik:RadRibbonGroup Header="Test">
        <Telerik:RadRibbonGroup.Variants>
            <Telerik:GroupVariant Priority="2" Variant="Small" />
            <Telerik:GroupVariant Priority="1" Variant="Medium" />
            <Telerik:GroupVariant Priority="0" Variant="Large" />
        </Telerik:RadRibbonGroup.Variants>
        ...
    </Telerik:RadRibbonGroup>

    But how can I do this when using the ribbon view in MVVM style as described in your Paint example? Here is my code:

    <DataTemplate x:Name="ButtonTemplate">
        <Telerik:RadRibbonButton
            CollapseToMedium="WhenGroupIsMedium"
            CollapseToSmall="WhenGroupIsSmall"
            IsAutoSize="True"
            LargeImage="{Binding LargeIcon}"
            Size="Large"
            SmallImage="{Binding Icon}"
            Text="{Binding Caption}" />
    </DataTemplate>
     
    <DataTemplate x:Name="ButtonGroupTemplate">
        <Telerik:ItemsControl ItemsSource="{Binding Items}" ItemTemplate="{StaticResource ButtonTemplate}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Telerik:RadCollapsiblePanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </Telerik:ItemsControl>
    </DataTemplate>
     
    <Design:RibbonDataTemplateSelector
        x:Key="RibbonButtonDataTemplateSelector"
        Button="{StaticResource ButtonTemplate}"
        ButtonGroup="{StaticResource ButtonGroupTemplate}" />
     
    <Telerik:HierarchicalDataTemplate
        x:Name="RibbonGroupTemplate"
        ItemsSource="{Binding Items}"
        ItemTemplateSelector="{StaticResource RibbonButtonDataTemplateSelector}">
        <TextBlock Text="{Binding Caption}" />
    </Telerik:HierarchicalDataTemplate>
     
    <Telerik:HierarchicalDataTemplate
        x:Name="RibbonTabTemplate"
        ItemsSource="{Binding Items}"
        ItemTemplate="{StaticResource RibbonGroupTemplate}">
        <TextBlock Text="{Binding Caption}" />
    </Telerik:HierarchicalDataTemplate>

    Where do I specify the group variants here?


    Regards,
    Stephan


    Reply

  • Petar Mladenov Petar Mladenov admin's avatar

    Posted on Sep 20, 2011 (permalink)

    Hello Stephan,

    Currently, you cannot bind the RibbonGroup.Variants collection. You can vote for this PITS item in order to increase its development priority. Feel free to ask if you need further info.

    Greetings,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Trang avatar

    Posted on Apr 17, 2012 (permalink)

    Hello,

    It looks like the PITS item has been resolved. What is the best way to specify the group variants when using MVVM?

    Thanks!

    Reply

  • Viktor Tsvetkov Viktor Tsvetkov admin's avatar

    Posted on Apr 19, 2012 (permalink)

    Hi Trang,

    You can examine the attached sample project which shows one databound ribbon and one xaml created. If you have further questions feel free to ask.

    All the best,
    Viktor Tsvetkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > RibbonView > How to specify group variants when using MVVM