This is a migrated thread and some comments may be shown as answers.

RadRibbonTab Set KeyTipService.AccessText through style

2 Answers 195 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Oscar Ågren
Top achievements
Rank 1
Oscar Ågren asked on 12 Jul 2012, 04:02 PM
Hi,

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

Update:
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:KeyTipService.IsKeyTipsEnabled="true"                       
                      telerik:KeyTipService.AccessKey="ALT">
          <telerik:RadRibbonView.QuickAccessToolBar>
              <telerik:QuickAccessToolBar ItemsSource="{Binding QuickAccessItems}"
                      ItemTemplate="{StaticResource ButtonTemplate}" />
          </telerik:RadRibbonView.QuickAccessToolBar>
  <telerik:RadRibbonView.ItemContainerStyle>
      <!-- This style seems to affect all containers, tabs, groups and buttons -->
          <Style>                   
              <Setter Property="telerik:KeyTipService.AccessText" Value="{Binding AccessText}" />
          </Style>
  </telerik:RadRibbonView.ItemContainerStyle>
  </telerik:RadRibbonView>

I am trying to implement a very standard feature...
 Please help me,
Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Miro Miroslavov
Telerik team
answered on 17 Jul 2012, 09:14 AM
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}"/>
</DataTemplate>

I also removed the key tips from the tab template:

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

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.

0
Oscar Ågren
Top achievements
Rank 1
answered on 04 Aug 2012, 12:39 PM
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.
Tags
RibbonView and RibbonWindow
Asked by
Oscar Ågren
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Oscar Ågren
Top achievements
Rank 1
Share this question
or