Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara authored Nov 5, 2023
1 parent e1278cf commit ba87f20
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions ModernWpf.Controls/NavigationView/NavigationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1862,8 +1862,8 @@ double init()
newButtonWidths = init();
}

templateSettings.PaneButtonWidth = newButtonWidths;
templateSettings.LatestPaneButtonWidth = newButtonWidths - 8;
templateSettings.PaneToggleButtonWidth = newButtonWidths;
templateSettings.SmallerPaneToggleButtonWidth = newButtonWidths - 8;
}

void OnBackButtonClicked(object sender, RoutedEventArgs args)
Expand Down Expand Up @@ -4516,7 +4516,7 @@ void UpdatePaneToggleSize()
{
if (m_rootSplitView is { } splitView)
{
double width = GetTemplateSettings().PaneButtonWidth;
double width = GetTemplateSettings().PaneToggleButtonWidth;
double togglePaneButtonWidth = width;

if (ShouldShowBackButton() && splitView.DisplayMode == SplitViewDisplayMode.Overlay)
Expand Down
6 changes: 3 additions & 3 deletions ModernWpf.Controls/NavigationView/NavigationView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Border x:Name="IconColumn" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.LatestIconColumnWidth}">
<Border x:Name="IconColumn" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.SmallerIconWidth}">
<Viewbox x:Name="IconBox"
Height="16"
Margin="{DynamicResource NavigationViewItemOnLeftIconBoxMargin}">
Expand Down Expand Up @@ -1000,7 +1000,7 @@
<Button
x:Name="NavigationViewBackButton"
Style="{DynamicResource NavigationBackButtonNormalStyle}"
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.LatestPaneButtonWidth}"
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.SmallerPaneToggleButtonWidth}"
VerticalAlignment="Top"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.BackButtonVisibility}"
IsEnabled="{TemplateBinding IsBackEnabled}">
Expand All @@ -1022,7 +1022,7 @@
HorizontalAlignment="Center"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneToggleButtonVisibility}"
VerticalAlignment="Top"
MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.LatestPaneButtonWidth}">
MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.SmallerPaneToggleButtonWidth}">
<TextBlock
x:Name="PaneTitleTextBlock"
Grid.Column="0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ internal void UpdateCompactPaneLength(double compactPaneLength, bool shouldUpdat
var templateSettings = TemplateSettings;
var gridLength = compactPaneLength;

templateSettings.IconColumnWidth = gridLength;
templateSettings.LatestIconColumnWidth = gridLength - 8;
templateSettings.IconWidth = gridLength;
templateSettings.SmallerIconWidth = gridLength - 8;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@ public NavigationViewItemPresenterTemplateSettings()
{
}

#region IconColumnWidth
#region IconWidth

private static readonly DependencyPropertyKey IconColumnWidthPropertyKey =
private static readonly DependencyPropertyKey IconWidthPropertyKey =
DependencyProperty.RegisterReadOnly(
nameof(IconColumnWidth),
nameof(IconWidth),
typeof(double),
typeof(NavigationViewItemPresenterTemplateSettings),
null);

public static readonly DependencyProperty IconColumnWidthProperty =
IconColumnWidthPropertyKey.DependencyProperty;
public static readonly DependencyProperty IconWidthProperty =
IconWidthPropertyKey.DependencyProperty;

public double IconColumnWidth
public double IconWidth
{
get => (double)GetValue(IconColumnWidthProperty);
internal set => SetValue(IconColumnWidthPropertyKey, value);
get => (double)GetValue(IconWidthProperty);
internal set => SetValue(IconWidthPropertyKey, value);
}

#endregion

#region LatestIconColumnWidth
#region SmallerIconWidth

private static readonly DependencyPropertyKey LatestIconColumnWidthPropertyKey =
private static readonly DependencyPropertyKey SmallerIconWidthPropertyKey =
DependencyProperty.RegisterReadOnly(
nameof(LatestIconColumnWidth),
nameof(SmallerIconWidth),
typeof(double),
typeof(NavigationViewItemPresenterTemplateSettings),
null);

public static readonly DependencyProperty LatestIconColumnWidthProperty =
LatestIconColumnWidthPropertyKey.DependencyProperty;
public static readonly DependencyProperty SmallerIconWidthProperty =
SmallerIconWidthPropertyKey.DependencyProperty;

public double LatestIconColumnWidth
public double SmallerIconWidth
{
get => (double)GetValue(LatestIconColumnWidthProperty);
internal set => SetValue(LatestIconColumnWidthPropertyKey, value);
get => (double)GetValue(SmallerIconWidthProperty);
internal set => SetValue(SmallerIconWidthPropertyKey, value);
}

#endregion
Expand Down
32 changes: 16 additions & 16 deletions ModernWpf.Controls/NavigationView/NavigationViewTemplateSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,42 +151,42 @@ public bool SingleSelectionFollowsFocus

#endregion

#region LatestPaneButtonWidth
#region SmallerPaneToggleButtonWidth

private static readonly DependencyPropertyKey LatestPaneButtonWidthPropertyKey =
private static readonly DependencyPropertyKey SmallerPaneToggleButtonWidthPropertyKey =
DependencyProperty.RegisterReadOnly(
nameof(LatestPaneButtonWidth),
nameof(SmallerPaneToggleButtonWidth),
typeof(double),
typeof(NavigationViewTemplateSettings),
null);

public static readonly DependencyProperty LatestPaneButtonWidthProperty =
LatestPaneButtonWidthPropertyKey.DependencyProperty;
public static readonly DependencyProperty SmallerPaneToggleButtonWidthProperty =
SmallerPaneToggleButtonWidthPropertyKey.DependencyProperty;

public double LatestPaneButtonWidth
public double SmallerPaneToggleButtonWidth
{
get => (double)GetValue(LatestPaneButtonWidthProperty);
internal set => SetValue(LatestPaneButtonWidthPropertyKey, value);
get => (double)GetValue(SmallerPaneToggleButtonWidthProperty);
internal set => SetValue(SmallerPaneToggleButtonWidthPropertyKey, value);
}

#endregion

#region PaneButtonWidth
#region PaneToggleButtonWidth

private static readonly DependencyPropertyKey PaneButtonWidthPropertyKey =
private static readonly DependencyPropertyKey PaneToggleButtonWidthPropertyKey =
DependencyProperty.RegisterReadOnly(
nameof(PaneButtonWidth),
nameof(PaneToggleButtonWidth),
typeof(double),
typeof(NavigationViewTemplateSettings),
null);

public static readonly DependencyProperty PaneButtonWidthProperty =
PaneButtonWidthPropertyKey.DependencyProperty;
public static readonly DependencyProperty PaneToggleButtonWidthProperty =
PaneToggleButtonWidthPropertyKey.DependencyProperty;

public double PaneButtonWidth
public double PaneToggleButtonWidth
{
get => (double)GetValue(PaneButtonWidthProperty);
internal set => SetValue(PaneButtonWidthPropertyKey, value);
get => (double)GetValue(PaneToggleButtonWidthProperty);
internal set => SetValue(PaneToggleButtonWidthPropertyKey, value);
}

#endregion
Expand Down

0 comments on commit ba87f20

Please sign in to comment.