Skip to content

Commit

Permalink
Fixes #804 by adding VerticalIconAlignment to RibbonWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Jun 12, 2020
1 parent 1ac2813 commit 3551910
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
- [#795](../../issues/795) - Check mark of menuitem not visible
- [#798](../../issues/798) - The elements in the ribbon use ElementName = xxx to bind the data and cannot find the xxx element

- ### Enhancements/Features
- [#804](../../issues/804) - Ribbon Window's Icon Not Centered
Added `VerticalIconAlignment` to `RibbonWindow`

## 7.1.0

- ### Bug fixes
Expand Down
16 changes: 13 additions & 3 deletions Fluent.Ribbon/Controls/RibbonWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,28 @@ public Brush NonActiveBorderBrush
#endregion

/// <summary>
/// Gets or sets whether icon is visible
/// Gets or sets whether icon is visible.
/// </summary>
public bool IsIconVisible
{
get { return (bool)this.GetValue(IsIconVisibleProperty); }
set { this.SetValue(IsIconVisibleProperty, value); }
}

/// <summary>Identifies the <see cref="IsIconVisible"/> dependency property.</summary>
public static readonly DependencyProperty IsIconVisibleProperty = DependencyProperty.Register(nameof(IsIconVisible), typeof(bool), typeof(RibbonWindow), new FrameworkPropertyMetadata(BooleanBoxes.TrueBox));

/// <summary>
/// Gets or sets whether icon is visible
/// Gets or sets the vertical alignment of the icon.
/// </summary>
public static readonly DependencyProperty IsIconVisibleProperty = DependencyProperty.Register(nameof(IsIconVisible), typeof(bool), typeof(RibbonWindow), new FrameworkPropertyMetadata(BooleanBoxes.TrueBox));
public VerticalAlignment VerticalIconAlignment
{
get { return (VerticalAlignment)this.GetValue(VerticalIconAlignmentProperty); }
set { this.SetValue(VerticalIconAlignmentProperty, value); }
}

/// <summary>Identifies the <see cref="VerticalIconAlignment"/> dependency property.</summary>
public static readonly DependencyProperty VerticalIconAlignmentProperty = DependencyProperty.Register(nameof(VerticalIconAlignment), typeof(VerticalAlignment), typeof(RibbonWindow), new PropertyMetadata(VerticalAlignment.Top));

// todo check if IsCollapsed and IsAutomaticCollapseEnabled should be reduced to one shared property for RibbonWindow and Ribbon

Expand Down
2 changes: 1 addition & 1 deletion Fluent.Ribbon/Themes/RibbonWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
Height="16"
Width="16"
Margin="4,2,0,0"
VerticalAlignment="Top"
VerticalAlignment="{TemplateBinding VerticalIconAlignment}"
Stretch="Uniform"
Visibility="{TemplateBinding IsIconVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
Source="{Fluent:IconConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, {Binding RelativeSource={RelativeSource Self}}}"
Expand Down

0 comments on commit 3551910

Please sign in to comment.