Skip to content

Commit

Permalink
Merge pull request #598 from MahApps/556-header-text-ellipses
Browse files Browse the repository at this point in the history
MetroWindow layout now respects TextTrimming
  • Loading branch information
punker76 committed Oct 4, 2013
2 parents c811273 + 9d25c89 commit b2dd280
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions MahApps.Metro/Themes/MetroWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@
<Grid.Background>
<SolidColorBrush Color="{DynamicResource WhiteColor}"/>
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="PART_TitleBar"
Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}"
Visibility="{TemplateBinding ShowTitleBar, Converter={StaticResource BooleanToVisibilityConverter}}" Background="{DynamicResource WindowTitleColorBrush}">
Visibility="{TemplateBinding ShowTitleBar, Converter={StaticResource BooleanToVisibilityConverter}}" Background="{DynamicResource WindowTitleColorBrush}"
Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
Expand All @@ -65,14 +70,18 @@
Content="{Binding WindowCommands, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}"
x:Name="PART_WindowCommands"
Panel.ZIndex="1"
Grid.RowSpan="2"
Grid.Column="1"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}" />
<ContentPresenter Grid.Row="1"/>
<ContentPresenter Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2" />

<ContentControl
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.RowSpan="2"
Panel.ZIndex="2"
KeyboardNavigation.TabNavigation="None"
Expand Down Expand Up @@ -128,7 +137,7 @@
<ControlTemplate.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="#02FFFFFF" />
<Setter Property="Background" Value="{DynamicResource TransparentWhiteBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
Expand Down Expand Up @@ -178,7 +187,7 @@
</ResourceDictionary>
</ControlTemplate.Resources>

<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" Background="{DynamicResource WindowTitleColorBrush}">
<ItemsControl IsTabStop="False" ItemsSource="{Binding Items, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:WindowCommands}}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
Expand Down
2 changes: 1 addition & 1 deletion samples/MetroDemo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:MetroDemo="clr-namespace:MetroDemo"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MahApps.Metro.Demo"
Title="MahApps.Metro - Demo Application"
Width="960"
Height="600"
Icon="mahapps.metro.logo2.ico"
Expand Down

0 comments on commit b2dd280

Please sign in to comment.