RadRibbonTab Set KeyTipService.AccessText through style

3 posts, 1 answers
  1. Oscar Ågren
    Oscar Ågren avatar
    5 posts
    Member since:
    Aug 2012

    Posted 12 Jul 2012 Link to this post


    I'm trying to get Key Tips working for the buttons in my RadRibbonView. It's based on your mvvm example. I have managed to bind AccessText to the buttons with ease and to the RadRibbonGroup through a setter in ItemContainerStyle of the HierarchicalDataTemplate.

    But none of these KeyTips will show unless the parent RadRibbonTab has AccessText set. But setting this property seems like a tough challenge.

    <HierarchicalDataTemplate x:Key="GroupHeaderTemplate" ItemsSource="{Binding Buttons}"  DataType="{x:Type Menu:GroupViewModel}"
                       ItemTemplateSelector="{StaticResource groupsSelector}">
               <TextBlock Text="{Binding Text}" />
           <HierarchicalDataTemplate x:Key="TabTemplate" DataType="{x:Type Menu:TabViewModel}" ItemsSource="{Binding Groups}"                                             
                       ItemTemplate="{StaticResource GroupHeaderTemplate}">
                   <!-- This works and AccessText binds to GroupViewModel.AccessText -->
                   <Style TargetType="{x:Type telerik:RadRibbonGroup}">
                       <Setter Property="telerik:KeyTipService.AccessText" Value="{Binding AccessText}" />
               <TextBlock Text="{Binding Text}" />

    I tried setting ItemContainerStyle directly on RibbonView, now KeyTips show for the Tabs, but not for Groups or Buttons (even though the AccessText property is invoked on each viewmodel)
    <telerik:RadRibbonView  x:Name="ribbonView" ApplicationButtonVisibility="Collapsed"
                          VerticalAlignment="Top" ItemTemplate="{StaticResource TabTemplate}" ItemsSource="{Binding Tabs}"
                           Title="{Binding Title}" SelectedItem="{Binding SelectedTab, Mode=TwoWay}"                       
                  <telerik:QuickAccessToolBar ItemsSource="{Binding QuickAccessItems}"
                          ItemTemplate="{StaticResource ButtonTemplate}" />
          <!-- This style seems to affect all containers, tabs, groups and buttons -->
                  <Setter Property="telerik:KeyTipService.AccessText" Value="{Binding AccessText}" />

    I am trying to implement a very standard feature...
     Please help me,
  2. Answer
    Miro Miroslavov
    Miro Miroslavov avatar
    588 posts

    Posted 17 Jul 2012 Link to this post

    Hello Oscar Ågren,

    I tried your sample code with slight modifications and everything work on my side. So you don't need KeyTips on the groups in most cases (they are useful only when are collapsed) but you do need KeyTips on the Buttons. So i modified the buttons template like follows and they showed as well as the Tab tips.
    <DataTemplate x:Key="ButtonTemplate">
                <telerik:RadRibbonButton Text="{Binding Text}" Size="{Binding Size}" CollapseToSmall="WhenGroupIsSmall"
                            SmallImage="{Binding SmallImage}" LargeImage="{Binding LargeImage}" telerik:KeyTipService.AccessText="{Binding AccessText}"/>

    I also removed the key tips from the tab template:

    <HierarchicalDataTemplate x:Key="TabTemplate" ItemsSource="{Binding Groups}"
                    ItemTemplate="{StaticResource GroupHeaderTemplate}">
                <TextBlock Text="{Binding Text}" />

    Please let us know if this works for you. Thank you. Regards,
    Miro Miroslavov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Oscar Ågren
    Oscar Ågren avatar
    5 posts
    Member since:
    Aug 2012

    Posted 04 Aug 2012 Link to this post

    I just returned from being afk a few weeks. Thanks for the help, I solved it with your help. I had some final struggle but placing all buttons inside buttongroups solved everything.
Back to Top