Skip to content

Commit

Permalink
Merge pull request #528 from snowdreamist/master
Browse files Browse the repository at this point in the history
Fix TabStripPlacement  bug(#527) on system default TabControl
  • Loading branch information
AzureKitsune committed Jun 11, 2013
2 parents f0a7b33 + c2cada2 commit c1650b6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
28 changes: 28 additions & 0 deletions MahApps.Metro/Styles/Controls.TabControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,34 @@
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="TabStripPlacement" Value="Bottom">
<Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
<Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
</Trigger>
<Trigger Property="TabStripPlacement" Value="Left">
<Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
<Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
<Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
<Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
<Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
<Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
</Trigger>
<Trigger Property="TabStripPlacement" Value="Right">
<Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
<Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
<Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
<Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
<Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
<Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down
18 changes: 18 additions & 0 deletions samples/MetroDemo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,24 @@
<TextBlock FontSize="30" Text="This is not content (it is)" />
</Controls:MetroTabItem>
</Controls:MetroTabControl>
<TabControl TabStripPlacement="Left" Style="{DynamicResource MetroTabControl}">
<TabItem Header="LeftItem0" Content="This is left content 0" />
<TabItem Header="LeftItem1" Content="This is left content 1" />
<TabItem Header="LeftItem2" Content="This is left content 2" />
</TabControl>
<!--
Right & Bottom are both work, no need to show them all
<TabControl TabStripPlacement="Right" Style="{DynamicResource MetroTabControl}">
<TabItem Header="RightItem0" Content="This is Right content 0" />
<TabItem Header="RightItem1" Content="This is Right content 1" />
<TabItem Header="RightItem2" Content="This is Right content 2" />
</TabControl>
<TabControl TabStripPlacement="Bottom" Style="{DynamicResource MetroTabControl}">
<TabItem Header="BottomItem0" Content="This is Bottom content 0" />
<TabItem Header="BottomItem1" Content="This is Bottom content 1" />
<TabItem Header="BottomItem2" Content="This is Bottom content 2" />
</TabControl>
-->
</StackPanel>

</ScrollViewer>
Expand Down

0 comments on commit c1650b6

Please sign in to comment.