Skip to content

Commit

Permalink
Merge pull request #1013 from 100GPing100/patch-8
Browse files Browse the repository at this point in the history
Tile font size
  • Loading branch information
AzureKitsune committed Feb 7, 2014
2 parents a5428bb + e6d24d9 commit ae00c78
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
20 changes: 19 additions & 1 deletion MahApps.Metro/Controls/Tile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,23 @@ public int TiltFactor
get { return (Int32)GetValue(TiltFactorProperty); }
set { SetValue(TiltFactorProperty, value); }
}

public static readonly DependencyProperty TitleFontSizeProperty =
DependencyProperty.Register("TitleFontSize", typeof(int), typeof(Tile), new PropertyMetadata(16));

public int TitleFontSize
{
get { return (int) GetValue(TitleFontSizeProperty); }
set { SetValue(TitleFontSizeProperty, value); }
}

public static readonly DependencyProperty CountFontSizeProperty =
DependencyProperty.Register("CountFontSize", typeof(int), typeof(Tile), new PropertyMetadata(28));

public int CountFontSize
{
get { return (int) GetValue(CountFontSizeProperty); }
set { SetValue(CountFontSizeProperty, value); }
}
}
}
}
10 changes: 7 additions & 3 deletions MahApps.Metro/Themes/Tile.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
Value="Center" />
<Setter Property="RenderTransformOrigin"
Value="0.5,0.5" />
<Setter Property="TitleFontSize"
Value="16"/>
<Setter Property="CountFontSize"
Value="28"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Controls:Tile">
Expand All @@ -28,7 +32,7 @@
Orientation="Horizontal">
<ContentPresenter RecognizesAccessKey="True" />
<TextBlock Text="{TemplateBinding Count}"
FontSize="28"
FontSize="{Binding CountFontSize, RelativeSource={RelativeSource TemplatedParent}}"
VerticalAlignment="Center" />
</StackPanel>

Expand All @@ -39,7 +43,7 @@
<AccessText Text="{Binding Title, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
TextWrapping="Wrap"
FontSize="16"
FontSize="{Binding TitleFontSize, RelativeSource={RelativeSource TemplatedParent}}"
Margin="3" />
</Label>
</Grid>
Expand All @@ -60,4 +64,4 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary>

0 comments on commit ae00c78

Please sign in to comment.