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

RibbonView and quick access toolbar menu customization

3 Answers 193 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Pavel
Top achievements
Rank 1
Pavel asked on 15 Oct 2018, 09:26 AM

Hello!

How can I dynamically customize RibbonView quick access toolbar? I want to show and hide buttons using quick access toolbar menu like in Microsoft Office applications. It seems that this is not possible and menu is not customizable either.

Thank you.

 

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 18 Oct 2018, 08:41 AM
Hello Pavel,

If I understood your requirement correctly, you wish to dynamically modify the collection of RadRibbonView's quick access toolbar. Please let me know if I'm mistaken in this assumption.

If that is indeed the desired result, you can bind the QuickAccessToolBar's ItemsSource to a collection in your viewmodel and define an ItemTemplate for its items. Provided this collection implements the INotifyCollectionChanged interface, it will update the toolbar once new items are added.

I've attached a small sample project to my reply demonstrating the approach I have in mind.

Could you please have a look and let me know if it will work for you? If this is not what you had in mind, please provide more details on your exact setup and requirement and I will gladly assist you further.

I look forward to your reply.

Regards,
Dilyan Traykov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Pavel
Top achievements
Rank 1
answered on 18 Oct 2018, 10:16 AM

Hello!

Thank you for your answer.

I want to customize the toolbar using it's menu. But the menu itself is not customizable. Can you please check how this menu looks like in the Microsoft Office application? It contains list of available buttons with checkmarks. User can show or hide any button on the toolbar using this menu.

How can I add custom items to the toolbar menu?

Thank you.

0
Dilyan Traykov
Telerik team
answered on 19 Oct 2018, 11:27 AM
Hello Pavel,

Please excuse me for the misunderstanding.

I've updated the project to demonstrate a possible approach for customizing the toolbar per your requirement. For the purpose I've modified the control template of the QuickAccessToolBar element and added an ItemsControl bound to the ItemsSource of the QuickAccessToolBar of the RadRibbonView. The ItemTemplate of the control in turn uses the properties of the data items to show and hide the items from the toolbar itself.

Please note that these changes are specific to the Office2016 theme and if you're using another one you should extract and modify the templates accordingly.

Please have a look and let me know whether this would work for you.

Regards,
Dilyan Traykov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Ivan
Top achievements
Rank 1
Iron
commented on 03 Aug 2023, 08:11 AM

Thank you for the sample, it works with version 2023 R2. But now your sample just shows the buttons with images. Nothing hapens when user clicks on any button inside the Quick Access ToolBar. How to add command to Click event?

Could you please extend your sample to add comands to the DataItems?

 

Thank you!

 
Martin Ivanov
Telerik team
commented on 07 Aug 2023, 03:39 PM

I already posted a reply in the ticket related to this thread (1618797). I am attaching the modified version of Dilyan's project where no ControlTemplate modifications are requirement also here.

As for Dilyan's example, you can add actions by adding a new property of type ICommand in the DataItem class from the project. Then, you can data bind this property in the RadRibbonButton defined in the ItemTemplate.

<DataTemplate x:Key="Template">
	<telerik:RadRibbonButton Text="{Binding Header}"
							 Command="{Binding MyCommand}"
							 Visibility="{Binding IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
							 Size="Small" SmallImage="{Binding ImageUrl}"
							 telerik:KeyTipService.AccessText="{Binding AccessText}" />
</DataTemplate>

For each DataItem you can define a different ICommand isntance. I hope that helps.

Tags
RibbonView and RibbonWindow
Asked by
Pavel
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Pavel
Top achievements
Rank 1
Share this question
or