locked
Ribbon Tabs and their definition RRS feed

  • Question

  • Hello,

    I have a a Ribbon control with mutliple tabs, that are pretty big, which makes the xaml very unreadable....

    My goal was to put each tab into a sepertate file as resource, but i just can't get it to work.

    Theres no "Tabs" property etc.

    So, is there any way to define a RibbonTab outside of the ribbon itself and use it?

    Thanks!


    Wednesday, August 10, 2011 7:12 AM

Answers

  • Use this code to put the RibbonTabs in one array:

      <xxx.Resources>
        <x:Array Type="{x:Type ribbon:RibbonTab}" x:Key="tabs">
          <ribbon:RibbonTab Header="Home"/>
          <ribbon:RibbonTab Header="Edit"/>
        </x:Array>
      </xxx.Resources>

     

    And set the StaticResource or DynamicResource on the Ribbon.ItemsSource to this array:

     <ribbon:Ribbon x:Name="Ribbon" ItemsSource="{StaticResource tabs}">
     </ribbon:Ribbon>

     

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jie Bao Monday, August 15, 2011 5:27 AM
    • Marked as answer by Jie Bao Wednesday, August 17, 2011 4:45 PM
    Monday, August 15, 2011 5:26 AM

All replies

  • Hi,

     

    I havent really used this control before but if you were using a normal tab control you could have say 5 tab items and each tab item contained a seperate user control  where you could put the xaml and logic for that particular. 

     

    Would that work in your scenario? Something like this

     

    <Tabcontrol>

    <TabItem Header="TabItemOne">

    <controls:TabcontrolOne />

    </TabItem>

     

    <TabItem Header="TabItemTwo">

    <controls:TabcontrolTwo />

    </TabItem>

    </TabControl>

     

    Wednesday, August 10, 2011 7:30 AM
  • Use this code to put the RibbonTabs in one array:

      <xxx.Resources>
        <x:Array Type="{x:Type ribbon:RibbonTab}" x:Key="tabs">
          <ribbon:RibbonTab Header="Home"/>
          <ribbon:RibbonTab Header="Edit"/>
        </x:Array>
      </xxx.Resources>

     

    And set the StaticResource or DynamicResource on the Ribbon.ItemsSource to this array:

     <ribbon:Ribbon x:Name="Ribbon" ItemsSource="{StaticResource tabs}">
     </ribbon:Ribbon>

     

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jie Bao Monday, August 15, 2011 5:27 AM
    • Marked as answer by Jie Bao Wednesday, August 17, 2011 4:45 PM
    Monday, August 15, 2011 5:26 AM