Skip to content

Commit

Permalink
Merge branch 'master' into devsecops
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-ivanov committed Nov 25, 2023
2 parents 510741e + f9af0ac commit 87d8b10
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 61 deletions.
13 changes: 1 addition & 12 deletions ModernWpf.Controls/NavigationView/NavigationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1849,18 +1849,7 @@ void UpdatePaneButtonsWidths()
{
var templateSettings = GetTemplateSettings();

double newButtonWidths;
{
double init()
{
if (DisplayMode == NavigationViewDisplayMode.Minimal)
{
return c_paneToggleButtonWidth;
}
return CompactPaneLength;
}
newButtonWidths = init();
}
var newButtonWidths = CompactPaneLength;

templateSettings.PaneToggleButtonWidth = newButtonWidths;
templateSettings.SmallerPaneToggleButtonWidth = newButtonWidths - 8;
Expand Down
20 changes: 17 additions & 3 deletions ModernWpf.Controls/NavigationView/NavigationView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
x:Name="IconBox"
Height="16"
Width="16"
Margin="12,0,0,0"
Margin="16,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<ContentPresenter
Expand Down Expand Up @@ -1016,7 +1016,8 @@
HorizontalAlignment="Center"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneToggleButtonVisibility}"
VerticalAlignment="Top"
MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.SmallerPaneToggleButtonWidth}">
MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.SmallerPaneToggleButtonWidth}"
ui:FocusVisualHelper.FocusVisualMargin="0">
<TextBlock
x:Name="PaneTitleTextBlock"
Grid.Column="0"
Expand All @@ -1025,6 +1026,7 @@
VerticalAlignment="Center"
Style="{DynamicResource NavigationViewItemHeaderTextStyle}"/>
</Button>

<Grid
x:Name="PaneTitleHolder"
Visibility="Collapsed">
Expand Down Expand Up @@ -1255,7 +1257,19 @@
x:Name="PaneAutoSuggestButton"
Visibility="Collapsed"
Style="{DynamicResource NavigationViewPaneSearchButtonStyle}"
Width="{TemplateBinding CompactPaneLength}"/>
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.SmallerPaneToggleButtonWidth}">
<Button.Resources>
<ui:StaticResource x:Key="ButtonBackgroundPointerOver" ResourceKey="NavigationViewItemBackgroundPointerOver" />
<ui:StaticResource x:Key="ButtonBackgroundPressed" ResourceKey="NavigationViewItemBackgroundPressed" />
<ui:StaticResource x:Key="ButtonBackgroundDisabled" ResourceKey="NavigationViewItemBackgroundDisabled" />
<ui:StaticResource x:Key="ButtonForegroundPointerOver" ResourceKey="NavigationViewItemForegroundPointerOver" />
<ui:StaticResource x:Key="ButtonForegroundPressed" ResourceKey="NavigationViewItemForegroundPressed" />
<ui:StaticResource x:Key="ButtonForegroundDisabled" ResourceKey="NavigationViewItemForegroundDisabled" />
<ui:StaticResource x:Key="ButtonBorderBrushPointerOver" ResourceKey="NavigationViewItemBorderBrushPointerOver" />
<ui:StaticResource x:Key="ButtonBorderBrushPressed" ResourceKey="NavigationViewItemBorderBrushPressed" />
<ui:StaticResource x:Key="ButtonBorderBrushDisabled" ResourceKey="NavigationViewItemBorderBrushDisabled" />
</Button.Resources>
</Button>
</Grid>

<ContentControl
Expand Down
9 changes: 8 additions & 1 deletion ModernWpf.Controls/SplitButton/SplitButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,14 @@ internal void UpdateVisualStates(bool useTransitions = true)
{
if (m_isFlyoutOpen)
{
VisualStateManager.GoToState(this, "FlyoutOpen", useTransitions);
if (InternalIsChecked)
{
VisualStateManager.GoToState(this, "CheckedFlyoutOpen", useTransitions);
}
else
{
VisualStateManager.GoToState(this, "FlyoutOpen", useTransitions);
}
}
// SplitButton and ToggleSplitButton share a template -- this section is driving the checked states for ToggleSplitButton.
else if (InternalIsChecked)
Expand Down
27 changes: 8 additions & 19 deletions ModernWpf.Controls/SplitButton/SplitButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<ResourceDictionary Source="/ModernWpf;component/Styles/Button.xaml" />
</ResourceDictionary.MergedDictionaries>

<sys:Double x:Key="SplitButtonPrimaryButtonSize">32</sys:Double>
<sys:Double x:Key="SplitButtonSecondaryButtonSize">32</sys:Double>
<sys:Double x:Key="SplitButtonPrimaryButtonSize">35</sys:Double>
<sys:Double x:Key="SplitButtonSecondaryButtonSize">35</sys:Double>

<ui:CornerRadiusFilterConverter x:Key="LeftCornerRadiusFilterConverter" Filter="Left" />
<ui:CornerRadiusFilterConverter x:Key="RightCornerRadiusFilterConverter" Filter="Right" />
Expand All @@ -30,7 +30,7 @@
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
<Setter Property="FocusVisualMargin" Value="-3" />
<Setter Property="FocusVisualMargin" Value="-1" />
<Setter Property="IsTabStop" Value="True" />
<Setter Property="Padding" Value="{DynamicResource ButtonPadding}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
Expand Down Expand Up @@ -163,7 +163,7 @@
Grid.Column="0"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderThickness="0"
BorderBrush="Transparent"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Expand All @@ -185,21 +185,22 @@
Grid.Column="2"
Foreground="{DynamicResource SplitButtonForegroundSecondary}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderThickness="0"
BorderBrush="Transparent"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Padding="0,0,9,0"
Padding="0,0,12,0"
Focusable="False">
<Button.Content>
<ui:FontIconFallback
Height="12"
Width="12"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="8"
Data="{StaticResource ChevronDownSmall}"
VerticalAlignment="Center"
Padding="2,4,2,0"
HorizontalAlignment="Right" />
</Button.Content>
</Button>
Expand All @@ -225,34 +226,26 @@
<!-- PrimaryPointerOver -->
<Trigger SourceName="CommonStatesListener" Property="CurrentStateName" Value="PrimaryPointerOver">
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundPointerOver}" />
<Setter TargetName="PrimaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPointerOver}" />
<Setter TargetName="PrimaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackground}" />
<Setter TargetName="DividerBackgroundGrid" Property="Background" Value="Transparent" />
</Trigger>
<!-- PrimaryPressed -->
<Trigger SourceName="CommonStatesListener" Property="CurrentStateName" Value="PrimaryPressed">
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter TargetName="PrimaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter TargetName="PrimaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackground}" />
<Setter TargetName="DividerBackgroundGrid" Property="Background" Value="Transparent" />
</Trigger>
<!-- SecondaryPointerOver -->
<Trigger SourceName="CommonStatesListener" Property="CurrentStateName" Value="SecondaryPointerOver">
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackground}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundPointerOver}" />
<Setter TargetName="SecondaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPointerOver}" />
<Setter TargetName="SecondaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundSecondary}" />
<Setter TargetName="DividerBackgroundGrid" Property="Background" Value="Transparent" />
</Trigger>
<!-- SecondaryPressed -->
<Trigger SourceName="CommonStatesListener" Property="CurrentStateName" Value="SecondaryPressed">
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackground}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter TargetName="SecondaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter TargetName="SecondaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundSecondaryPressed}" />
<Setter TargetName="DividerBackgroundGrid" Property="Background" Value="Transparent" />
</Trigger>
<!-- Checked -->
<Trigger SourceName="CommonStatesListener" Property="CurrentStateName" Value="Checked">
Expand Down Expand Up @@ -288,7 +281,6 @@
<Trigger SourceName="CommonStatesListener" Property="CurrentStateName" Value="CheckedPrimaryPointerOver">
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" />
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPointerOver}" />
<Setter TargetName="PrimaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPointerOver}" />
<Setter TargetName="PrimaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
<Setter TargetName="SecondaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
Expand All @@ -299,7 +291,6 @@
<Trigger SourceName="CommonStatesListener" Property="CurrentStateName" Value="CheckedPrimaryPressed">
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" />
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter TargetName="PrimaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter TargetName="PrimaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
<Setter TargetName="SecondaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
Expand All @@ -312,7 +303,6 @@
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
<Setter TargetName="PrimaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPointerOver}" />
<Setter TargetName="SecondaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPointerOver}" />
<Setter TargetName="SecondaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
<Setter TargetName="DividerBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBorderBrushCheckedDivider}"/>
Expand All @@ -323,7 +313,6 @@
<Setter TargetName="PrimaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
<Setter TargetName="PrimaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
<Setter TargetName="SecondaryBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter TargetName="SecondaryButton" Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter TargetName="SecondaryButton" Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
<Setter TargetName="DividerBackgroundGrid" Property="Background" Value="{DynamicResource SplitButtonBorderBrushCheckedDivider}"/>
Expand Down
2 changes: 1 addition & 1 deletion ModernWpf/Styles/NavigationBackButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</Setter.Value>
</Setter>
<Setter Property="Margin" Value="4,2" />
<Setter Property="primitives:ControlHelper.CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
<Setter Property="primitives:ControlHelper.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
Expand Down
Loading

0 comments on commit 87d8b10

Please sign in to comment.