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

Button Icon resizing #286

Closed
wants to merge 1 commit into from
Closed
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
38 changes: 38 additions & 0 deletions Fluent.Ribbon/Controls/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,44 @@ private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedE
}
#endregion

#region IconHeight

/// <summary>
/// Gets or sets icon height
/// </summary>
public int IconHeight
{
get { return (int)this.GetValue(IconHeightProperty); }
set { this.SetValue(IconHeightProperty, value); }
}

/// <summary>
/// Using a DependencyProperty as the backing store for IconHeight. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IconHeightProperty =
DependencyProperty.Register("IconHeight", typeof(int), typeof(Button), new UIPropertyMetadata(32));

#endregion

#region IconWidth

/// <summary>
/// Gets or sets icon width
/// </summary>
public int IconWidth
{
get { return (int)this.GetValue(IconWidthProperty); }
set { this.SetValue(IconWidthProperty, value); }
}

/// <summary>
/// Using a DependencyProperty as the backing store for IconWidth. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IconWidthProperty =
DependencyProperty.Register("IconWidth", typeof(int), typeof(Button), new UIPropertyMetadata(32));

#endregion

#region LargeIcon

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Fluent.Ribbon/Themes/Office2010/Controls/Button.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
d:LayoutOverrides="Width, Height">
<ContentPresenter x:Name="iconImage"
HorizontalAlignment="Center"
Height="32"
Height="{Binding IconHeight, RelativeSource={RelativeSource TemplatedParent}}"
VerticalAlignment="Center"
Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static Converters:StaticConverters.ObjectToImageConverter}}"
Width="32"
Width="{Binding IconWidth, RelativeSource={RelativeSource TemplatedParent}}"
Margin="3,2,3,1"
SnapsToDevicePixels="True" />
<Fluent:TwoLineLabel x:Name="controlLabel"
Expand Down
4 changes: 2 additions & 2 deletions Fluent.Ribbon/Themes/Office2013/Controls/Button.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
d:LayoutOverrides="Width, Height">
<ContentPresenter x:Name="iconImage"
HorizontalAlignment="Center"
Height="32"
Height="{Binding IconHeight, RelativeSource={RelativeSource TemplatedParent}}"
VerticalAlignment="Center"
Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static Converters:StaticConverters.ObjectToImageConverter}}"
Width="32"
Width="{Binding IconWidth, RelativeSource={RelativeSource TemplatedParent}}"
Margin="3,2,3,1"
SnapsToDevicePixels="True" />
<Fluent:TwoLineLabel x:Name="controlLabel"
Expand Down
4 changes: 2 additions & 2 deletions Fluent.Ribbon/Themes/Windows8/Controls/Button.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
d:LayoutOverrides="Width, Height">
<ContentPresenter x:Name="iconImage"
HorizontalAlignment="Center"
Height="32"
Height="{Binding IconHeight, RelativeSource={RelativeSource TemplatedParent}}"
VerticalAlignment="Center"
Content="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static Converters:StaticConverters.ObjectToImageConverter}}"
Width="32"
Width="{Binding IconWidth, RelativeSource={RelativeSource TemplatedParent}}"
Margin="3,2,3,1"
SnapsToDevicePixels="True" />
<Fluent:TwoLineLabel x:Name="controlLabel"
Expand Down