Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile font size #1013

Merged
merged 2 commits into from
Feb 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>