I have a ribbon in my view named 'ribbon' that have 2 tabs as below sample codes. I want Button1 when clicked will open Tab2 and vice versa. How would I do this?
<ribbon:Ribbon x:Name="ribbon" HelpPaneContent="{x:Static data:WordModel.Help}">
<ribbon:RibbonTab Header="Tab1" ... >
<ribbon:RibbonGroup x:Name="Button1" >
<ribbon:RibbonButton Clicked="SwitchToTab2" />
</ribbon:RibbonGroup>
</ribbon:RibbonTab>
<ribbon:RibbonTab Header="Tab2" ... >
<ribbon:RibbonGroup x:Name="Button2" >
<ribbon:RibbonButton Clicked="SwitchToTab1" />
</ribbon:RibbonGroup>
</ribbon:RibbonTab>
...
</ribbon:Ribbon>
You only have to trigger the IsSelected property of your tabs
private void SwitchToTab1(object sender, MouseButtonEventArgs e)
{
ribbontab1.IsSelected = true;
}
private void SwitchToTab2(object sender, MouseButtonEventArgs e)
{
ribbontab2.IsSelected = true;
}