It happens if you add the contextual group in code, and it is set as active.
The size of the Tab inside the group should also be larger then the size of the header. The result is at appeared in the image.
Here is the code:
Main window xaml:
<telerik:RadRibbonWindow x:Class="ContextualTab_Bug.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525" WindowState="Maximized"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition /> </Grid.RowDefinitions> <telerik:RadRibbonView telerik:StyleManager.Theme="Windows7" ApplicationButtonContent="Home" x:Name="ribbon"> <telerik:RadRibbonTab Foreground="Black" Header="Edit" telerik:KeyTipService.AccessText="E"> </telerik:RadRibbonTab> <telerik:RadRibbonTab Header="Controller" Foreground="Black" telerik:KeyTipService.AccessText="P" IsSelected="True"> </telerik:RadRibbonTab> <telerik:RadRibbonTab Header="Tools" ToolTip="Tools" telerik:KeyTipService.AccessText="T"> </telerik:RadRibbonTab> <telerik:RadRibbonTab Header="Help" telerik:KeyTipService.AccessText="S"> </telerik:RadRibbonTab> </telerik:RadRibbonView> <Button HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Click="Button_Click">Add Contextual Tabs</Button> </Grid></telerik:RadRibbonWindow>
code behind that demonstrates the problem:
public partial class MainWindow : RadRibbonWindow { bool tabWasAdded = false; public MainWindow() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { if (!tabWasAdded) { RadRibbonContextualGroup telerikContextualTab = new RadRibbonContextualGroup() { Name = "ct", }; telerikContextualTab.Header = "Alarm"; telerikContextualTab.IsActive = true; telerikContextualTab.Color = Brushes.Red; RadRibbonTab tab = new RadRibbonTab(); tab.Header = "Alarms"; tab.ContextualGroupName = "ct"; ribbon.ContextualGroups.Add(telerikContextualTab); ribbon.Items.Insert(ribbon.Items.Count - 1, tab); tabWasAdded = true; } else { ribbon.ContextualGroups[0].IsActive = !ribbon.ContextualGroups[0].IsActive; } } }}
If you click the twice again, then the contextual tabs will become inactive and then active, and this time, it will appear correctly.
It will also be drawn with the correct size, if you just resize the window.
I have a workaround for this issue:
Add the group with IsActive=false, and then Set the IsActive=true with BeginInvoke with priority Render and higher...
