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

Can insert ControPanelItems in style

10 Answers 157 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 13 Sep 2016, 08:43 AM

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

Sort by
0
Accepted
Stefan Nenchev
Telerik team
answered on 13 Sep 2016, 02:44 PM
Hi Dario,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 14 Sep 2016, 09:12 AM

Ok, it's clear!

Thank you Stefan.

0
Dario Concilio
Top achievements
Rank 2
answered on 14 Sep 2016, 12:49 PM

Is it possibile make this in RadRibbonTab objects?

 

<Style x:Key="MenuCommonForList" TargetType="telerik:RadRibbonTab" BasedOn="{StaticResource RadRibbonTabStyle}">
        <Setter Property="?????">

0
Stefan Nenchev
Telerik team
answered on 15 Sep 2016, 12:36 PM
Hello Dario,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 15 Sep 2016, 12:49 PM

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>

0
Stefan Nenchev
Telerik team
answered on 20 Sep 2016, 06:46 AM
Hi Dario,

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}" >
. . .
You can also check the following thread - Reuse RadRibbonGroup - where my colleague has provided a sample on how to reuse a RadRibbonGroup.

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 20 Sep 2016, 06:58 AM

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="?????">

 

0
Martin
Telerik team
answered on 22 Sep 2016, 02:22 PM
Hi Dario,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Accepted
Martin Ivanov
Telerik team
answered on 27 Sep 2016, 01:01 PM
Hello Dario,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 27 Sep 2016, 03:02 PM

Perfect!

Just what I was looking for.

Thank you Martin

Tags
GridView
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Stefan Nenchev
Telerik team
Dario Concilio
Top achievements
Rank 2
Martin
Telerik team
Martin Ivanov
Telerik team
Share this question
or