Hi,
I would simplify XAML code in my view, can I move ControPanelItems tag and its content into style?
I tryed but I don't understand if it's possible or not.
10 Answers, 1 is accepted
Please check the following article from our documentation page - Reusing Control Panel Items where the requirement you have is explained. You can also find a demo with the same title in our SDK Samples Browser.
Regards,
Stefan Nenchev
Telerik by Progress
Ok, it's clear!
Thank you Stefan.
Is it possibile make this in RadRibbonTab objects?
<
Style
x:Key
=
"MenuCommonForList"
TargetType
=
"telerik:RadRibbonTab"
BasedOn
=
"{StaticResource RadRibbonTabStyle}"
>
<
Setter
Property
=
"?????"
>
Indeed, it is possible. I am not sure of your overall intentions though so sharing more details regarding your intentions will be appreciated.
Regards,
Stefan Nenchev
Telerik by Progress
Sure!
I haveseveral usercontrol, all of these could have same RadRibbonTab.
I would like to avoid rewriting the XAML parties, because they will always the same
Some tab should be common to all the user control.
01.
<
telerik:RadRibbonView
x:Name
=
"MainRadRibbonView"
Style
=
"{StaticResource CardRibbonViewStyle}"
>
02.
<
telerik:RadRibbonTab
Header
=
"Lista"
Tag
=
"LIST"
>
03.
<
telerik:RadRibbonGroup
Header
=
"Stampa"
>
04.
<
telerik:RadRibbonButton
Text
=
"Anteprima"
Command
=
"{Binding PreviewListCommand}"
ToolTip
=
"Anteprima della lista"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/PrintForm_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/PrintForm.png"
/>
05.
<
telerik:RadRibbonButton
Text
=
"Stampa"
Command
=
"{Binding PrintListCommand}"
ToolTip
=
"Stampa la lista direttamente sulla stampante predefinita"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/Print_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/Print.png"
/>
06.
</
telerik:RadRibbonGroup
>
07.
<
telerik:RadRibbonGroup
Header
=
"Esporta"
>
08.
<
telerik:RadRibbonButton
Text
=
"Excel"
Command
=
"{Binding ExportToExcelListCommand}"
ToolTip
=
"Genera file Excel della lista"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/ExportToExcel_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/ExportToExcel.png"
/>
09.
<
telerik:RadRibbonButton
Text
=
"CSV"
Command
=
"{Binding ExportToCsvListCommand}"
ToolTip
=
"Genera file CSV della lista"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/ExportFile_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/ExportFile.png"
/>
10.
<
telerik:RadRibbonButton
Text
=
"PDF"
Command
=
"{Binding CreatePdfListCommand}"
ToolTip
=
"Genera PDF della lista"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/SendAsPDF_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/SendAsPDF.png"
/>
11.
</
telerik:RadRibbonGroup
>
12.
</
telerik:RadRibbonTab
>
13.
<
telerik:RadRibbonTab
Header
=
"Vettore"
Tag
=
"RECORD"
>
14.
<
telerik:RadRibbonGroup
Header
=
"Modifica"
>
15.
<
telerik:RadRibbonButton
Text
=
"Nuovo"
Command
=
"{Binding NewItemRecordCommand}"
ToolTip
=
"Apre la scheda per un nuovo vettore"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/New_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/New.png"
/>
16.
<
telerik:RadRibbonButton
Text
=
"Scheda"
Command
=
"{Binding OpenItemRecordCommand}"
ToolTip
=
"Apre la scheda del vettore"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/Card_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/Card.png"
/>
17.
<
telerik:RadRibbonButton
Text
=
"Elimina"
Command
=
"{Binding DeleteItemRecordCommand}"
ToolTip
=
"Elimina il vettore"
Size
=
"Large"
SmallImage
=
"pack://application:,,,/Brema.Resources;component/16/Delete_16.png"
LargeImage
=
"pack://application:,,,/Brema.Resources;component/32/Delete.png"
/>
18.
</
telerik:RadRibbonGroup
>
19.
</
telerik:RadRibbonTab
>
20.
</
telerik:RadRibbonView
>
Excuse me if I am missing something, but from what I understand you would like to use a certain Style for multiple RadRibbonTabs. If this is the case, you can define the Style and simply apply it:
<
telerik:RadRibbonTab
Header
=
"Tab"
Style
=
"{StaticResource myStyle}"
>
. . .
Regards,
Stefan Nenchev
Telerik by Progress
I'll explain, my problem is not set style to control, but how create a style.
I think that the bast way is apply a style to RadRibbonGroup, that contains several RadRibbonTab. These tabs could be into a style.
How can I write this style? Which property I have to define the new style?
RadRibbonGroup has an ItemCollection, how can I do that?
This style could add a list of RadRibbonTab into RadRibbonGroup, and after that, I could add other tabs (by code) also, because tabs of style are common to all views, tabs by code are custom of specific view.
I hope I have clarified the situation.
<
Style
x:Key
=
"MenuCommonForList"
TargetType
=
"telerik:RadRibbonTab"
BasedOn
=
"{StaticResource RadRibbonTabStyle}"
>
<
Setter
Property
=
"?????"
>
We are working with limited resources because of the national holidays in Bulgaria and will need some more time to look into the case. I will mark this thread as requiring an additional answer and we will get back to you once we have more information on your scenario. Thank you for understanding.
Regards,
Martin Vatev
Telerik by Progress
As I understand, you want to have a predefined set of ribbon tabs that are displayed in the ribbonview of all UserControls. Let me start with that the RadRibbonGroup control actually is a child of RadRibbonTab and nesting of RadRibbonTabs into a group is not recommended. Also, placing a ribbon group into the ribbonview children will wrap it into a RadRibbonTab. So, in the end you will have a RadRibbonTabs wrapped into a single RadRibbonTab.
In order to achieve your requirement you can create few UserControls that derive from RadRibbonTab and define the ribbon elements which will be displayed (buttons, groups, etc.). Then on initialize of the usercontrol add the ribbon tab UserControls in the Items collection of the corresponding ribbonview. You can see this approach demonstrated in the attached project. Please give it a try and let me know if it helps.
Regards,
Martin
Telerik by Progress
Perfect!
Just what I was looking for.
Thank you Martin