Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara authored Dec 6, 2023
1 parent 8a95126 commit 691d74d
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 131 deletions.
15 changes: 15 additions & 0 deletions ModernWpf.Controls/NavigationView/NavigationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,8 @@ void OnSplitViewPaneClosing(DependencyObject sender, SplitViewPaneClosingEventAr
VisualStateManager.GoToState(this, "ListSizeCompact", true /*useTransitions*/);
UpdatePaneToggleSize();
}

VisualStateManager.GoToState(this, "PaneNotOverlaying", true /*useTransitions*/);
}
}
}
Expand All @@ -1806,6 +1808,14 @@ void OnSplitViewPaneOpening(DependencyObject sender, object obj)
{
// See UpdateIsClosedCompact 'RS3+ animation timing enhancement' for explanation:
VisualStateManager.GoToState(this, "ListSizeFull", true /*useTransitions*/);

if (m_rootSplitView is { } splitView)
{
if (splitView.DisplayMode == SplitViewDisplayMode.CompactOverlay || splitView.DisplayMode == SplitViewDisplayMode.Overlay)
{
VisualStateManager.GoToState(this, "PaneOverlaying", true /*useTransitions*/);
}
}
}

PaneOpening?.Invoke(this, null);
Expand Down Expand Up @@ -4636,6 +4646,11 @@ void UpdateBackAndCloseButtonsVisibility()

if (m_paneContentGrid is { } paneContentGridAsUIE)
{
if (paneContentGridAsUIE is Border paneContentGridAsBorder)
{
paneContentGridAsUIE = paneContentGridAsBorder.Child;
}

if (paneContentGridAsUIE is Grid paneContentGrid)
{
var rowDefs = paneContentGrid.RowDefinitions;
Expand Down
246 changes: 133 additions & 113 deletions ModernWpf.Controls/NavigationView/NavigationView.xaml

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions ModernWpf.Controls/SplitView/SplitView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
Expand All @@ -10,7 +9,7 @@
namespace ModernWpf.Controls
{
[ContentProperty(nameof(Content))]
public partial class SplitView : Control
public partial class SplitView : ControlEx
{
static SplitView()
{
Expand Down
41 changes: 26 additions & 15 deletions ModernWpf.Controls/SplitView/SplitView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
<GridLength x:Key="ZeroGridLength">0</GridLength>

<Style TargetType="local:SplitView">
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundTransparentBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource SplitViewLeftBorderThemeThickness}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="OpenPaneLength" Value="{DynamicResource SplitViewOpenPaneThemeLength}" />
<Setter Property="CompactPaneLength" Value="{DynamicResource SplitViewCompactPaneThemeLength}" />
<Setter Property="PaneBackground" Value="{DynamicResource SystemControlPageBackgroundChromeLowBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource SplitViewPaneRootCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:SplitView">
Expand Down Expand Up @@ -593,36 +596,45 @@
<ColumnDefinition x:Name="ColumnDefinition1" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneGridLength, FallbackValue={StaticResource ZeroGridLength}}" />
<ColumnDefinition x:Name="ColumnDefinition2" Width="*" />
</Grid.ColumnDefinitions>
<!-- Pane Content Area -->
<Grid

<!-- Pane Content Area -->
<Border
x:Name="PaneRoot"
Grid.ColumnSpan="2"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="Left"
Visibility="Collapsed"
Background="{TemplateBinding PaneBackground}"
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneLength}"
Canvas.ZIndex="1"
CornerRadius="{TemplateBinding CornerRadius}"
KeyboardNavigation.TabNavigation="Local"
KeyboardNavigation.TabIndex="0">
<Grid.Clip>
<Border.Clip>
<RectangleGeometry x:Name="PaneClipRectangle">
<RectangleGeometry.Transform>
<TranslateTransform x:Name="PaneClipRectangleTransform" />
</RectangleGeometry.Transform>
</RectangleGeometry>
</Grid.Clip>
<Grid.RenderTransform>
</Border.Clip>

<Border.RenderTransform>
<TranslateTransform x:Name="PaneTransform" />
</Grid.RenderTransform>
<Border ui:BorderHelper.Child="{TemplateBinding Pane}" />
<Rectangle
x:Name="HCPaneBorder"
Visibility="Collapsed"
Fill="{DynamicResource SystemControlForegroundTransparentBrush}"
Width="1"
HorizontalAlignment="Right" />
</Border.RenderTransform>

</Grid>
<Grid>
<Border ui:BorderHelper.Child="{TemplateBinding Pane}" />

<Rectangle
x:Name="HCPaneBorder"
Visibility="Collapsed"
Fill="{DynamicResource SystemControlForegroundTransparentBrush}"
Width="1"
HorizontalAlignment="Right" />
</Grid>
</Border>

<!-- Content Area -->
<Grid
x:Name="ContentRoot"
Expand All @@ -635,7 +647,6 @@
x:Name="LightDismissLayer"
Fill="Transparent"
Visibility="Collapsed" />

</Grid>

</Grid>
Expand Down
22 changes: 22 additions & 0 deletions ModernWpf/Controls/ControlEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Windows;
using System.Windows.Controls;
using ModernWpf.Controls.Primitives;

namespace ModernWpf.Controls
{
public class ControlEx : Control
{
#region CornerRadius

public static readonly DependencyProperty CornerRadiusProperty =
ControlHelper.CornerRadiusProperty.AddOwner(typeof(ControlEx));

public CornerRadius CornerRadius
{
get => (CornerRadius)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}

#endregion
}
}
6 changes: 6 additions & 0 deletions ModernWpf/ControlsResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
<Thickness x:Key="MenuFlyoutItemThemePadding">11,8,11,9</Thickness>
<Thickness x:Key="MenuFlyoutItemThemePaddingNarrow">11,4,11,5</Thickness>

<sys:Double x:Key="SplitViewOpenPaneThemeLength">320</sys:Double>
<sys:Double x:Key="SplitViewCompactPaneThemeLength">48</sys:Double>
<Thickness x:Key="SplitViewLeftBorderThemeThickness">0,0,1,0</Thickness>
<Thickness x:Key="SplitViewRightBorderThemeThickness">1,0,0,0</Thickness>
<CornerRadius x:Key="SplitViewPaneRootCornerRadius">0</CornerRadius>

<ControlTemplate x:Key="TextControlValidationErrorTemplate">
<Grid SnapsToDevicePixels="True">
<AdornedElementPlaceholder />
Expand Down
6 changes: 5 additions & 1 deletion test/NavigationView_TestUI/Common/NavigationViewPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@ Nullam egestas, orci sed molestie aliquet, diam ex euismod risus, ac dapibus qua
<Button x:Name="PaneFooterButton" AutomationProperties.Name="PaneFooterButton" Content="PaneFooter Button" Margin="8"/>
<muxcontrols:NavigationViewItem x:Name="PaneFooterNavigationViewItem"
AutomationProperties.Name="PaneFooterNavigationViewItem"
Content="NVI" />
Content="NVI">
<muxcontrols:NavigationViewItem.Icon>
<muxcontrols:SymbolIcon Symbol="Accept" />
</muxcontrols:NavigationViewItem.Icon>
</muxcontrols:NavigationViewItem>
</StackPanel>
</muxcontrols:NavigationView.PaneFooter>
</muxcontrols:NavigationView>
Expand Down

0 comments on commit 691d74d

Please sign in to comment.