Can insert ControPanelItems in style

11 posts, 2 answers
  1. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 13 Sep Link to this post

    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.

  2. Answer
    Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    280 posts

    Posted 13 Sep Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 14 Sep in reply to Stefan Nenchev Link to this post

    Ok, it's clear!

    Thank you Stefan.

  5. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 14 Sep in reply to Dario Concilio Link to this post

    Is it possibile make this in RadRibbonTab objects?

     

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

  6. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    280 posts

    Posted 15 Sep Link to this post

    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.
  7. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 15 Sep in reply to Stefan Nenchev Link to this post

    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>

  8. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    280 posts

    Posted 20 Sep Link to this post

    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.
  9. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 20 Sep in reply to Stefan Nenchev Link to this post

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

     

  10. Martin Vatev
    Admin
    Martin Vatev avatar
    90 posts

    Posted 22 Sep Link to this post

    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.
  11. Answer
    Martin
    Admin
    Martin avatar
    1101 posts

    Posted 27 Sep Link to this post

    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.
  12. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 27 Sep in reply to Martin Link to this post

    Perfect!

    Just what I was looking for.

    Thank you Martin

Back to Top
UI for WPF is Visual Studio 2017 Ready