Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

style: customize NavigationView to allow Auto-Width items, animation and scrollable Top NavigationView

fatDuck986f5a1352f9
diff --git a/.codegraph/codegraph.lock b/.codegraph/codegraph.lock
new file mode 100644
index 0000000..276c791
--- /dev/null
+++ b/.codegraph/codegraph.lock
@@ -0,0 +1 @@
+13024
\ No newline at end of file
diff --git a/.github/.copilot-commit-message-instructions.md b/.github/.copilot-commit-message-instructions.md
index 793e203..33412f5 100644
--- a/.github/.copilot-commit-message-instructions.md
+++ b/.github/.copilot-commit-message-instructions.md
@@ -1,42 +1,60 @@
-The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with [SemVer](http://semver.org), by describing the features, fixes, and breaking changes made in commit messages.
+# Commit Message Instructions
-The commit message should be structured as follows:
+## Format
```
-<type>[optional scope]: <description>
+<type>: <short description>
[optional body]
[optional footer(s)]
```
-The commit contains the following structural elements, to communicate intent to the consumers of your library:
-
-1. **fix:** a commit of the *type* `fix` patches a bug in your codebase (this correlates with [`PATCH`](http://semver.org/#summary) in Semantic Versioning).
-2. **feat:** a commit of the *type* `feat` introduces a new feature to the codebase (this correlates with [`MINOR`](http://semver.org/#summary) in Semantic Versioning).
-3. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with [`MAJOR`](http://semver.org/#summary) in Semantic Versioning). A BREAKING CHANGE can be part of commits of any *type*.
-4. *types* other than `fix:` and `feat:` are allowed, for example [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) (based on the [Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines)) recommends `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.
-5. *footers* other than `BREAKING CHANGE: <description>` may be provided and follow a convention similar to [git trailer format](https://git-scm.com/docs/git-interpret-trailers).
-
-Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in Semantic Versioning (unless they include a BREAKING CHANGE). A scope may be provided to a commit's type, to provide additional contextual information and is contained within parenthesis, e.g., `feat(parser): add ability to parse arrays`.
-
-## Specification
-
-The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt).
-
-1. Commits MUST be prefixed with a type, which consists of a noun, `feat`, `fix`, etc., followed by the OPTIONAL scope, OPTIONAL `!`, and REQUIRED terminal colon and space.
-2. The type `feat` MUST be used when a commit adds a new feature to your application or library.
-3. The type `fix` MUST be used when a commit represents a bug fix for your application.
-4. A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., `fix(parser):`
-5. A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., *fix: array parsing issue when multiple spaces were contained in string*.
-6. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description.
-7. A commit body is free-form and MAY consist of any number of newline separated paragraphs.
-8. One or more footers MAY be provided one blank line after the body. Each footer MUST consist of a word token, followed by either a `:<space>` or `<space>#` separator, followed by a string value (this is inspired by the [git trailer convention](https://git-scm.com/docs/git-interpret-trailers)).
-9. A footer's token MUST use `-` in place of whitespace characters, e.g., `Acked-by` (this helps differentiate the footer section from a multi-paragraph body). An exception is made for `BREAKING CHANGE`, which MAY also be used as a token.
-10. A footer's value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer token/separator pair is observed.
-11. Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the footer.
-12. If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon, space, and description, e.g., *BREAKING CHANGE: environment variables now take precedence over config files*.
-13. If included in the type/scope prefix, breaking changes MUST be indicated by a `!` immediately before the `:`. If `!` is used, `BREAKING CHANGE:` MAY be omitted from the footer section, and the commit description SHALL be used to describe the breaking change.
-14. Types other than `feat` and `fix` MAY be used in your commit messages, e.g., *docs: update ref docs.*
-15. The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase.
-16. BREAKING-CHANGE MUST be synonymous with BREAKING CHANGE, when used as a token in a footer.
\ No newline at end of file
+## Allowed Types
+
+| Type | Usage |
+|------------|--------------------------------------------|
+| `feat:` | New feature |
+| `fix:` | Bug fix |
+| `refactor:`| Code change that neither fixes nor adds |
+| `docs:` | Documentation only |
+| `test:` | Adding or fixing tests |
+| `i18n:` | Translations / localization |
+| `chore:` | Build, tooling, deps, CI |
+
+## Rules
+
+- Use **lowercase** for type, short description, and scope.
+- Short description: imperative mood, no period, max ~72 chars.
+- Scope: optional noun in parentheses, e.g. `feat(startup): add virtualization`.
+- Body: wrap at 72 chars, explain *what* and *why*, not *how*.
+- Footer: `Closes #123`, `BREAKING CHANGE: <desc>`.
+- Branch naming: `feature/<name>` or `fix/<issue-id>` branching from `master`.
+- PRs: clear description, linked issue, passing `dotnet build` + `dotnet test`.
+- Never commit secrets or machine-specific paths.
+
+## Examples
+
+```
+feat(startup): add VirtualizingStackPanel with Recycling mode
+
+Enables container reuse when scrolling the startup apps list,
+reducing GC pressure and improving scroll smoothness.
+
+Closes #42
+```
+
+```
+fix(startup): remove CanContentScroll from outer ScrollViewer
+
+StackPanel children don't implement IScrollInfo so logical scrolling
+silently drops mouse-wheel events, making the page appear stuck.
+```
+
+```
+i18n: add Vietnamese translations for StartupManager page
+```
+
+```
+chore: update WPF UI package to 3.0.4
+```
diff --git a/optimizerDuck/App.xaml b/optimizerDuck/App.xaml
index 67347cd..f488a06 100644
--- a/optimizerDuck/App.xaml
+++ b/optimizerDuck/App.xaml
@@ -10,6 +10,7 @@
<ui:ThemesDictionary Theme="Dark" />
<ui:ControlsDictionary />
<ResourceDictionary Source="pack://application:,,,/UI/Styles/FluentDesign.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/UI/Styles/NavigationViewOverride.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="Image">
diff --git a/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml b/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml
index a18c7af..d82fe0d 100644
--- a/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml
+++ b/optimizerDuck/UI/Pages/Optimize/OptimizePage.xaml
@@ -25,6 +25,7 @@
IsPaneToggleVisible="False"
IsTopSeparatorVisible="False"
MenuItemsSource="{Binding ViewModel.OptimizationCategories}"
- PaneDisplayMode="Top" />
+ PaneDisplayMode="Top"
+ Style="{StaticResource ScrollableTopNavigationViewStyle}" />
</Grid>
</Page>
diff --git a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
index f7e3586..57d33ab 100644
--- a/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
+++ b/optimizerDuck/UI/Pages/ScheduledTasksPage.xaml
@@ -193,20 +193,18 @@
</StackPanel>
<!-- Task List -->
- <ui:VirtualizingItemsControl Grid.Row="1" ItemsSource="{Binding ViewModel.Tasks}" Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
- <ui:VirtualizingItemsControl.Template>
+ <ItemsControl
+ Grid.Row="1"
+ ItemsSource="{Binding ViewModel.Tasks}"
+ Visibility="{Binding ViewModel.Tasks.Count, Converter={StaticResource GreaterThanZeroToVisibilityConverter}}">
+ <ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer CanContentScroll="True" HorizontalScrollBarVisibility="Disabled">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
- </ui:VirtualizingItemsControl.Template>
- <ui:VirtualizingItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel IsVirtualizing="True" VirtualizationMode="Recycling" />
- </ItemsPanelTemplate>
- </ui:VirtualizingItemsControl.ItemsPanel>
- <ui:VirtualizingItemsControl.ItemTemplate>
+ </ItemsControl.Template>
+ <ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type scheduledTask:ScheduledTaskModel}">
<Border Style="{StaticResource ListRowStyle}">
<Grid>
@@ -412,8 +410,8 @@
</Grid>
</Border>
</DataTemplate>
- </ui:VirtualizingItemsControl.ItemTemplate>
- </ui:VirtualizingItemsControl>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
</Grid>
</Grid>
</Page>
diff --git a/optimizerDuck/UI/Styles/FluentDesign.xaml b/optimizerDuck/UI/Styles/FluentDesign.xaml
index 7e84ec6..6ac92c6 100644
--- a/optimizerDuck/UI/Styles/FluentDesign.xaml
+++ b/optimizerDuck/UI/Styles/FluentDesign.xaml
@@ -25,7 +25,6 @@
<Style x:Key="PageRootStyle" TargetType="Page">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Margin" Value="{StaticResource PageMargin}" />
- <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
</Style>
diff --git a/optimizerDuck/UI/Styles/NavigationViewOverride.xaml b/optimizerDuck/UI/Styles/NavigationViewOverride.xaml
new file mode 100644
index 0000000..d3d068b
--- /dev/null
+++ b/optimizerDuck/UI/Styles/NavigationViewOverride.xaml
@@ -0,0 +1,1109 @@
+<ResourceDictionary
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib"
+ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
+
+ <!-- Custom Left Navigation Item Template with animation -->
+ <ControlTemplate x:Key="AdaptiveLeftCompactNavigationViewItemTemplate" TargetType="{x:Type ui:NavigationViewItem}">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Border
+ x:Name="MainBorder"
+ Grid.Row="0"
+ MinWidth="40"
+ MinHeight="40"
+ Margin="0"
+ Padding="0"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{DynamicResource NavigationViewItemThickness}"
+ CornerRadius="{TemplateBinding Border.CornerRadius}">
+ <Border.Style>
+ <Style TargetType="{x:Type Border}">
+ <Setter Property="Background" Value="{DynamicResource NavigationViewItemBackground}" />
+ <Style.Triggers>
+ <Trigger Property="IsMouseOver" Value="True">
+ <Setter Property="Background" Value="{DynamicResource NavigationViewItemBackgroundPointerOver}" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Grid Background="Transparent">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="40" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Grid Grid.Column="0">
+ <ContentPresenter
+ x:Name="IconContentPresenter"
+ Margin="-1,0,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Icon}"
+ Focusable="False"
+ TextElement.FontSize="16"
+ TextElement.Foreground="{DynamicResource NavigationViewItemForeground}" />
+ </Grid>
+
+ <Rectangle
+ x:Name="ActiveRectangle"
+ Grid.Column="0"
+ Width="3"
+ Height="16"
+ Margin="0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Fill="{DynamicResource NavigationViewSelectionIndicatorForeground}"
+ Opacity="0.0"
+ RadiusX="2"
+ RadiusY="2" />
+
+ <ContentPresenter
+ x:Name="ElementContentPresenter"
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Content}"
+ ContentTemplate="{TemplateBinding ContentTemplate}"
+ RecognizesAccessKey="True"
+ TextElement.FontSize="14"
+ TextElement.Foreground="{TemplateBinding Foreground}" />
+
+ <ContentPresenter
+ x:Name="PART_InfoBadge"
+ Grid.Column="2"
+ Margin="0"
+ Content="{TemplateBinding InfoBadge}" />
+
+ <Grid
+ x:Name="PART_ChevronGrid"
+ Grid.Column="3"
+ Width="0"
+ Visibility="Collapsed">
+ <ui:SymbolIcon
+ x:Name="ChevronIcon"
+ Margin="0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontSize="{StaticResource NavigationViewItemChevronSize}"
+ Foreground="{DynamicResource NavigationViewItemForeground}"
+ RenderTransformOrigin="0.5, 0.5"
+ Symbol="ChevronDown24">
+ <ui:SymbolIcon.RenderTransform>
+ <RotateTransform Angle="0" />
+ </ui:SymbolIcon.RenderTransform>
+ </ui:SymbolIcon>
+ </Grid>
+ </Grid>
+ </Border>
+ <ItemsControl
+ x:Name="MenuItemsPresenter"
+ Grid.Row="1"
+ AutomationProperties.AutomationId="NavigationItemItems"
+ Focusable="False"
+ ItemsSource="{TemplateBinding MenuItems}"
+ KeyboardNavigation.DirectionalNavigation="Contained"
+ Opacity="0.0"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ScrollViewer.VerticalScrollBarVisibility="Disabled"
+ Visibility="Collapsed">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Margin="0" IsItemsHost="True" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.Resources>
+ <Style BasedOn="{StaticResource NavigationViewItemDefaultStyle}" TargetType="{x:Type ui:NavigationViewItem}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ui:NavigationViewItem}">
+ <Border
+ x:Name="MainBorder"
+ Height="40"
+ HorizontalAlignment="Stretch"
+ Background="Transparent"
+ BorderThickness="{DynamicResource NavigationViewItemThickness}"
+ CornerRadius="4">
+ <Grid Margin="30,0,0,0" HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" MinWidth="180" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Rectangle
+ x:Name="ActiveRectangle"
+ Grid.Column="0"
+ Width="3"
+ Height="16"
+ Margin="0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Fill="{DynamicResource NavigationViewSelectionIndicatorForeground}"
+ Opacity="0.0"
+ RadiusX="2"
+ RadiusY="2" />
+
+ <ContentPresenter
+ x:Name="IconContentPresenter"
+ Grid.Column="1"
+ Margin="6,0,3,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Icon}"
+ Focusable="False"
+ TextElement.FontSize="18"
+ TextElement.Foreground="{DynamicResource NavigationViewItemForeground}"
+ Visibility="{TemplateBinding Icon,
+ Converter={StaticResource NullToVisibilityConverter}}" />
+ <ContentPresenter
+ x:Name="ElementContentPresenter"
+ Grid.Column="2"
+ Margin="10,0,0,0"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Content}"
+ ContentTemplate="{TemplateBinding ContentTemplate}"
+ RecognizesAccessKey="True"
+ TextElement.FontSize="14"
+ TextElement.Foreground="{TemplateBinding Foreground}" />
+
+ <ContentPresenter Grid.Column="3" Content="{TemplateBinding InfoBadge}" />
+ </Grid>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsActive" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="0"
+ To="1"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Height"
+ From="4"
+ To="16"
+ Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="1"
+ To="0"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Height"
+ From="16"
+ To="4"
+ Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+ <Trigger Property="IsMouseOver" Value="True">
+ <Setter TargetName="MainBorder" Property="Background" Value="{DynamicResource NavigationViewItemBackgroundPointerOver}" />
+ </Trigger>
+ <Trigger Property="IsPressed" Value="True">
+ <Setter TargetName="MainBorder" Property="Background" Value="{DynamicResource NavigationViewItemBackgroundPressed}" />
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </ItemsControl.Resources>
+ </ItemsControl>
+ </Grid>
+ <ControlTemplate.Triggers>
+
+ <Trigger Property="IsPaneOpen" Value="True">
+ <Setter TargetName="PART_InfoBadge" Property="Grid.Column" Value="2" />
+ </Trigger>
+ <Trigger Property="IsPaneOpen" Value="False">
+ <Setter TargetName="PART_InfoBadge" Property="Grid.Column" Value="0" />
+ <Setter TargetName="PART_InfoBadge" Property="VerticalAlignment" Value="Top" />
+ <Setter TargetName="PART_InfoBadge" Property="HorizontalAlignment" Value="Right" />
+ </Trigger>
+
+ <Trigger Property="InfoBadge" Value="{x:Null}">
+ <Setter TargetName="PART_InfoBadge" Property="Margin" Value="0" />
+ <Setter TargetName="PART_InfoBadge" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ <Trigger Property="HasMenuItems" Value="True">
+ <Setter TargetName="PART_ChevronGrid" Property="Visibility" Value="Visible" />
+ <Setter TargetName="PART_ChevronGrid" Property="Width" Value="40" />
+ </Trigger>
+ <Trigger Property="IsExpanded" Value="True">
+ <Setter TargetName="MenuItemsPresenter" Property="Visibility" Value="Visible" />
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="MenuItemsPresenter"
+ Storyboard.TargetProperty="(ItemsControl.Opacity)"
+ From="0.0"
+ To="1.0"
+ Duration="00:00:00.167" />
+ <DoubleAnimation
+ Storyboard.TargetName="ChevronIcon"
+ Storyboard.TargetProperty="(Control.RenderTransform).(RotateTransform.Angle)"
+ To="-180"
+ Duration="00:00:00.167" />
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="MenuItemsPresenter"
+ Storyboard.TargetProperty="(ItemsControl.Opacity)"
+ From="1.0"
+ To="0.0"
+ Duration="00:00:00.167" />
+ <DoubleAnimation
+ Storyboard.TargetName="ChevronIcon"
+ Storyboard.TargetProperty="(Control.RenderTransform).(RotateTransform.Angle)"
+ To="0"
+ Duration="00:00:00.167" />
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+
+ <Trigger Property="IsActive" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="0"
+ To="1"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Height"
+ From="4"
+ To="16"
+ Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="1"
+ To="0"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Height"
+ From="16"
+ To="4"
+ Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+ <Trigger Property="Icon" Value="{x:Null}">
+ <Setter TargetName="IconContentPresenter" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ <MultiTrigger>
+ <MultiTrigger.Conditions>
+ <Condition Property="IsMouseOver" Value="True" />
+ <Condition Property="IsActive" Value="False" />
+ </MultiTrigger.Conditions>
+ <MultiTrigger.Setters>
+ <Setter TargetName="IconContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource NavigationViewItemForegroundPointerOver}" />
+ <Setter TargetName="ElementContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource NavigationViewItemForegroundPointerOver}" />
+ </MultiTrigger.Setters>
+ </MultiTrigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+
+ <!-- Custom Top Navigation Item Template with active indicator fix and animation -->
+ <ControlTemplate x:Key="ScrollableTopCompactNavigationViewItemTemplate" TargetType="{x:Type ui:NavigationViewItem}">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Border
+ x:Name="MainBorder"
+ Padding="0,0,0,4"
+ Background="Transparent">
+ <Grid>
+ <Grid
+ Margin="8,8,8,4"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <ContentPresenter
+ x:Name="IconContentPresenter"
+ Grid.Column="0"
+ Margin="0,0,6,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Icon}"
+ TextElement.FontSize="16"
+ TextElement.Foreground="{DynamicResource NavigationViewItemForeground}" />
+
+ <ContentPresenter
+ x:Name="ElementContentPresenter"
+ Grid.Column="1"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Content}"
+ ContentTemplate="{TemplateBinding ContentTemplate}"
+ RecognizesAccessKey="True"
+ TextElement.FontSize="14"
+ TextElement.Foreground="{TemplateBinding Foreground}" />
+ <Grid
+ x:Name="PART_ChevronGrid"
+ Grid.Column="2"
+ Width="0"
+ Visibility="Collapsed" />
+
+ <ContentPresenter
+ x:Name="PART_InfoBadge"
+ Grid.Column="2"
+ Margin="2"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding InfoBadge}" />
+ </Grid>
+
+ <Rectangle
+ x:Name="ActiveRectangle"
+ Width="16"
+ Height="3"
+ Margin="0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Bottom"
+ Fill="{DynamicResource NavigationViewSelectionIndicatorForeground}"
+ Opacity="0.0"
+ RadiusX="2"
+ RadiusY="2" />
+ </Grid>
+ </Border>
+ <Popup
+ x:Name="SubMenuPopup"
+ Grid.Row="1"
+ AllowsTransparency="True"
+ Focusable="False"
+ HorizontalOffset="-12"
+ IsOpen="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
+ Placement="Bottom"
+ PlacementTarget="{Binding ElementName=MainBorder}"
+ PopupAnimation="None"
+ StaysOpen="False"
+ VerticalOffset="1">
+
+ <Border
+ x:Name="SubMenuBorder"
+ Margin="12,0,12,18"
+ Padding="0,3,0,3"
+ Background="{DynamicResource FlyoutBackground}"
+ BorderBrush="{DynamicResource FlyoutBorderBrush}"
+ BorderThickness="1"
+ CornerRadius="8"
+ SnapsToDevicePixels="True">
+ <Border.RenderTransform>
+ <TranslateTransform />
+ </Border.RenderTransform>
+ <Border.Effect>
+ <DropShadowEffect
+ BlurRadius="20"
+ Direction="270"
+ Opacity="0.25"
+ ShadowDepth="6" />
+ </Border.Effect>
+
+ <ItemsControl
+ x:Name="SubMenuItemsPresenter"
+ Focusable="False"
+ ItemsSource="{TemplateBinding MenuItems}"
+ KeyboardNavigation.DirectionalNavigation="Contained"
+ Opacity="0.0"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Margin="0" IsItemsHost="True" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.Resources>
+ <Style BasedOn="{StaticResource NavigationViewItemDefaultStyle}" TargetType="{x:Type ui:NavigationViewItem}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ui:NavigationViewItem}">
+ <Border
+ x:Name="MainBorder"
+ Height="25"
+ Margin="0"
+ Padding="0"
+ HorizontalAlignment="Stretch"
+ BorderThickness="1"
+ CornerRadius="4">
+ <Grid Margin="0" HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="3" />
+ <ColumnDefinition Width="15" />
+ <ColumnDefinition Width="*" MinWidth="120" />
+ </Grid.ColumnDefinitions>
+ <Rectangle
+ x:Name="ActiveRectangle"
+ Grid.Column="0"
+ Width="3"
+ Height="16"
+ Margin="0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Fill="{DynamicResource NavigationViewSelectionIndicatorForeground}"
+ Opacity="0.0"
+ RadiusX="2"
+ RadiusY="2" />
+
+ <ContentPresenter
+ x:Name="IconContentPresenter"
+ Grid.Column="1"
+ Margin="0,0,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Icon}"
+ Focusable="False"
+ TextElement.FontSize="16"
+ TextElement.Foreground="{DynamicResource NavigationViewItemForeground}" />
+ <ContentPresenter
+ x:Name="ElementContentPresenter"
+ Grid.Column="2"
+ Margin="5,0,0,0"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ Content="{TemplateBinding Content}"
+ ContentTemplate="{TemplateBinding ContentTemplate}"
+ RecognizesAccessKey="True"
+ TextElement.FontSize="14"
+ TextElement.Foreground="{DynamicResource NavigationViewItemForeground}" />
+ </Grid>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsActive" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="0"
+ To="1"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Height"
+ From="4"
+ To="16"
+ Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="1"
+ To="0"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Height"
+ From="16"
+ To="4"
+ Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+ <Trigger Property="IsMouseOver" Value="True">
+ <Setter TargetName="MainBorder" Property="Background" Value="{DynamicResource NavigationViewItemBackgroundPointerOver}" />
+ </Trigger>
+ <Trigger Property="IsPressed" Value="True">
+ <Setter TargetName="MainBorder" Property="Background" Value="{DynamicResource NavigationViewItemBackgroundPressed}" />
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </ItemsControl.Resources>
+ </ItemsControl>
+ </Border>
+ </Popup>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <Trigger Property="HasMenuItems" Value="True">
+ <Setter TargetName="PART_ChevronGrid" Property="Visibility" Value="Visible" />
+ <Setter TargetName="PART_ChevronGrid" Property="Width" Value="20" />
+ </Trigger>
+ <Trigger Property="IsExpanded" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="SubMenuItemsPresenter"
+ Storyboard.TargetProperty="(UIElement.Opacity)"
+ From="0.0"
+ To="1.0"
+ Duration="0:0:0.167" />
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="SubMenuItemsPresenter"
+ Storyboard.TargetProperty="(UIElement.Opacity)"
+ From="1.0"
+ To="0.0"
+ Duration="0:0:0.167" />
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+ <Trigger Property="IsActive" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="0"
+ To="1"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation
+ Storyboard.TargetName="ActiveRectangle"
+ Storyboard.TargetProperty="Opacity"
+ From="1"
+ To="0"
+ Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CircleEase EasingMode="EaseOut" />
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+ <Trigger Property="Icon" Value="{x:Null}">
+ <Setter TargetName="IconContentPresenter" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ <Trigger Property="Content" Value="{x:Null}">
+ <Setter TargetName="IconContentPresenter" Property="Margin" Value="0" />
+ <Setter TargetName="ElementContentPresenter" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ <Trigger Property="Content" Value="">
+ <Setter TargetName="IconContentPresenter" Property="Margin" Value="0" />
+ <Setter TargetName="ElementContentPresenter" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+
+ <!-- Custom Left Navigation Template with auto-width pane -->
+ <ControlTemplate x:Key="AdaptiveLeftNavigationViewTemplate" TargetType="{x:Type ui:NavigationView}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <Grid
+ x:Name="PaneGrid"
+ Grid.Column="0"
+ Width="Auto"
+ Margin="4,0,4,0">
+ <Border x:Name="PaneBorder">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <Grid Grid.Row="0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <ui:Button
+ x:Name="PART_BackButton"
+ Grid.Row="0"
+ Margin="0,5,0,5"
+ HorizontalAlignment="Left"
+ AutomationProperties.AutomationId="NavigationBackButton"
+ IsEnabled="{TemplateBinding IsBackEnabled}"
+ Style="{StaticResource BasePaneButtonStyle}"
+ Visibility="{TemplateBinding IsBackButtonVisible,
+ Converter={StaticResource BackButtonVisibilityToVisibilityConverter}}">
+ <ui:Button.Icon>
+ <ui:SymbolIcon Symbol="ArrowLeft48" />
+ </ui:Button.Icon>
+ </ui:Button>
+
+ <ui:Button
+ x:Name="PART_ToggleButton"
+ Grid.Row="1"
+ Margin="0,0,0,5"
+ AutomationProperties.AutomationId="NavigationToggleButton"
+ Style="{StaticResource BasePaneButtonStyle}"
+ Visibility="{TemplateBinding IsPaneToggleVisible,
+ Converter={StaticResource BoolToVisibilityConverter}}">
+ <ui:Button.Icon>
+ <ui:SymbolIcon Symbol="LineHorizontal320" />
+ </ui:Button.Icon>
+ <ui:Button.Content>
+ <TextBlock FontWeight="Medium" Text="{TemplateBinding PaneTitle}" />
+ </ui:Button.Content>
+ </ui:Button>
+
+ <ContentPresenter
+ Grid.Row="2"
+ Margin="0"
+ Content="{TemplateBinding PaneHeader}" />
+
+ <ContentPresenter
+ x:Name="AutoSuggestBoxContentPresenter"
+ Grid.Row="3"
+ Margin="0,0,0,6"
+ Content="{TemplateBinding AutoSuggestBox}" />
+
+ <ui:Button
+ x:Name="PART_AutoSuggestBoxSymbolButton"
+ Grid.Row="3"
+ Margin="0,0,0,6"
+ AutomationProperties.AutomationId="NavigationAutoSuggestBoxButton"
+ Icon="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AutoSuggestBox.Icon}"
+ Style="{StaticResource BasePaneButtonStyle}"
+ Visibility="Hidden" />
+ </Grid>
+
+ <Border
+ x:Name="PART_TopSeparator"
+ Grid.Row="1"
+ Height="1"
+ Margin="0,4,0,4"
+ Background="{DynamicResource LeftNavigationViewSeparatorBrush}" />
+
+ <ui:DynamicScrollViewer
+ x:Name="PART_ScrollViewer"
+ Grid.Row="2"
+ Margin="0,0,-4,0"
+ Padding="0,0,4,0"
+ CanContentScroll="True"
+ HorizontalScrollBarVisibility="Disabled"
+ VerticalScrollBarVisibility="Auto">
+ <ItemsControl
+ x:Name="PART_MenuItemsItemsControl"
+ AutomationProperties.AutomationId="NavigationItems"
+ Focusable="False"
+ KeyboardNavigation.DirectionalNavigation="Contained"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel IsItemsHost="True" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ </ItemsControl>
+ </ui:DynamicScrollViewer>
+
+ <Border
+ x:Name="PART_FooterSeparator"
+ Grid.Row="3"
+ Height="1"
+ Margin="0,4,0,4"
+ Background="{DynamicResource LeftNavigationViewSeparatorBrush}" />
+
+ <Grid Grid.Row="4">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <ItemsControl
+ x:Name="PART_FooterMenuItemsItemsControl"
+ Grid.Row="0"
+ Margin="0,0,0,4"
+ AutomationProperties.AutomationId="NavigationFooterItems"
+ Focusable="False"
+ KeyboardNavigation.DirectionalNavigation="Contained"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Margin="0" IsItemsHost="True" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ </ItemsControl>
+
+ <ContentPresenter
+ Grid.Row="1"
+ Margin="0"
+ Content="{TemplateBinding PaneFooter}" />
+ </Grid>
+ </Grid>
+ </Border>
+ </Grid>
+
+ <Border
+ Grid.Column="1"
+ Margin="{TemplateBinding FrameMargin}"
+ Background="{DynamicResource NavigationViewContentBackground}"
+ BorderBrush="{DynamicResource NavigationViewContentGridBorderBrush}"
+ BorderThickness="1,1,0,0"
+ CornerRadius="8,0,0,0">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <ContentPresenter
+ Grid.Row="0"
+ Margin="0"
+ Content="{TemplateBinding Header}"
+ Visibility="{TemplateBinding HeaderVisibility}" />
+
+ <ui:NavigationViewContentPresenter
+ x:Name="PART_NavigationViewContentPresenter"
+ Grid.Row="1"
+ Padding="{TemplateBinding Padding}"
+ Transition="{TemplateBinding Transition}"
+ TransitionDuration="{TemplateBinding TransitionDuration}">
+ <ui:NavigationViewContentPresenter.Template>
+ <ControlTemplate TargetType="{x:Type ui:NavigationViewContentPresenter}">
+ <ContentPresenter x:Name="PART_FrameCP" Margin="{TemplateBinding Padding}" />
+ </ControlTemplate>
+ </ui:NavigationViewContentPresenter.Template>
+ </ui:NavigationViewContentPresenter>
+
+ <ContentPresenter
+ Grid.Row="0"
+ Grid.RowSpan="2"
+ Margin="0"
+ Content="{TemplateBinding ContentOverlay}" />
+ </Grid>
+ </Border>
+
+ <VisualStateManager.VisualStateGroups>
+ <VisualStateGroup Name="PaneStates">
+ <VisualState Name="PaneOpen">
+ <Storyboard>
+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="AutoSuggestBoxContentPresenter" Storyboard.TargetProperty="Visibility">
+ <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
+ </ObjectAnimationUsingKeyFrames>
+ <DoubleAnimation
+ AccelerationRatio="0.4"
+ Storyboard.TargetName="AutoSuggestBoxContentPresenter"
+ Storyboard.TargetProperty="Opacity"
+ From="0"
+ To="1"
+ Duration="0:0:.16" />
+ </Storyboard>
+ </VisualState>
+ <VisualState Name="PaneCompact">
+ <Storyboard>
+ <DoubleAnimation
+ AccelerationRatio="0.4"
+ Storyboard.TargetName="AutoSuggestBoxContentPresenter"
+ Storyboard.TargetProperty="Opacity"
+ From="1"
+ To="0"
+ Duration="0:0:.16" />
+ <DoubleAnimation
+ AccelerationRatio="0.4"
+ Storyboard.TargetName="PART_AutoSuggestBoxSymbolButton"
+ Storyboard.TargetProperty="Opacity"
+ From="0"
+ To="1"
+ Duration="0:0:.16" />
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneGrid" Storyboard.TargetProperty="Width">
+ <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="40" />
+ </DoubleAnimationUsingKeyFrames>
+ <ObjectAnimationUsingKeyFrames
+ BeginTime="0:0:0.16"
+ Storyboard.TargetName="AutoSuggestBoxContentPresenter"
+ Storyboard.TargetProperty="Visibility">
+ <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Hidden}" />
+ </ObjectAnimationUsingKeyFrames>
+ </Storyboard>
+ </VisualState>
+ </VisualStateGroup>
+ </VisualStateManager.VisualStateGroups>
+ </Grid>
+
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsPaneOpen" Value="False">
+ <Setter TargetName="PART_AutoSuggestBoxSymbolButton" Property="Visibility" Value="Visible" />
+ <Setter TargetName="PART_ToggleButton" Property="Content" Value="{x:Null}" />
+ </Trigger>
+ <MultiTrigger>
+ <MultiTrigger.Conditions>
+ <Condition Property="IsBackButtonVisible" Value="Collapsed" />
+ <Condition Property="IsPaneToggleVisible" Value="False" />
+ <Condition Property="AutoSuggestBox" Value="{x:Null}" />
+ <Condition Property="PaneHeader" Value="{x:Null}" />
+ </MultiTrigger.Conditions>
+ <Setter TargetName="PART_TopSeparator" Property="Visibility" Value="Collapsed" />
+ </MultiTrigger>
+ <Trigger Property="AutoSuggestBox" Value="{x:Null}">
+ <Setter TargetName="PART_AutoSuggestBoxSymbolButton" Property="Visibility" Value="Collapsed" />
+ <Setter TargetName="AutoSuggestBoxContentPresenter" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ <Trigger Property="PaneTitle" Value="{x:Null}">
+ <Setter TargetName="PART_ToggleButton" Property="Content" Value="{x:Null}" />
+ <Setter TargetName="PART_ToggleButton" Property="HorizontalAlignment" Value="Left" />
+ </Trigger>
+ <Trigger Property="IsTopSeparatorVisible" Value="False">
+ <Setter TargetName="PART_TopSeparator" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ <Trigger Property="IsFooterSeparatorVisible" Value="False">
+ <Setter TargetName="PART_FooterSeparator" Property="Visibility" Value="Collapsed" />
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+
+ <!-- Scrollable Top Navigation Template -->
+ <ControlTemplate x:Key="ScrollableTopNavigationViewTemplate" TargetType="{x:Type ui:NavigationView}">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <Grid x:Name="PaneGrid" Grid.Row="0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <ui:Button
+ x:Name="PART_BackButton"
+ Grid.Column="0"
+ IsEnabled="{TemplateBinding IsBackEnabled}"
+ Style="{StaticResource BasePaneButtonStyle}"
+ Visibility="{TemplateBinding IsBackButtonVisible,
+ Converter={StaticResource BackButtonVisibilityToVisibilityConverter}}">
+ <ui:Button.Icon>
+ <ui:SymbolIcon Symbol="ArrowLeft48" />
+ </ui:Button.Icon>
+ </ui:Button>
+
+ <ContentPresenter
+ Grid.Column="1"
+ Margin="0"
+ Content="{TemplateBinding PaneHeader}" />
+
+ <ScrollViewer
+ Grid.Column="2"
+ CanContentScroll="False"
+ HorizontalScrollBarVisibility="Auto"
+ VerticalScrollBarVisibility="Disabled">
+ <ItemsControl
+ x:Name="PART_MenuItemsItemsControl"
+ Focusable="False"
+ KeyboardNavigation.DirectionalNavigation="Contained">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel
+ Margin="0"
+ IsItemsHost="True"
+ Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ </ItemsControl>
+ </ScrollViewer>
+
+ <ContentPresenter Grid.Column="3" Content="{TemplateBinding AutoSuggestBox}" />
+
+ <ContentPresenter
+ Grid.Column="4"
+ Margin="0"
+ Content="{TemplateBinding PaneFooter}" />
+
+ <ScrollViewer
+ Grid.Column="5"
+ CanContentScroll="False"
+ HorizontalScrollBarVisibility="Auto"
+ VerticalScrollBarVisibility="Disabled">
+ <ItemsControl
+ x:Name="PART_FooterMenuItemsItemsControl"
+ Focusable="False"
+ KeyboardNavigation.DirectionalNavigation="Contained">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel
+ Margin="0"
+ IsItemsHost="True"
+ Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ </ItemsControl>
+ </ScrollViewer>
+ </Grid>
+
+ <Grid Grid.Row="1">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+
+ <ContentPresenter
+ Grid.Row="0"
+ Margin="0"
+ Content="{TemplateBinding Header}"
+ Visibility="{TemplateBinding HeaderVisibility}" />
+
+ <ui:NavigationViewContentPresenter
+ x:Name="PART_NavigationViewContentPresenter"
+ Grid.Row="1"
+ Padding="{TemplateBinding Padding}"
+ Transition="{TemplateBinding Transition}"
+ TransitionDuration="{TemplateBinding TransitionDuration}">
+ <ui:NavigationViewContentPresenter.Template>
+ <ControlTemplate TargetType="{x:Type ui:NavigationViewContentPresenter}">
+ <ContentPresenter x:Name="PART_FrameCP" Margin="{TemplateBinding Padding}" />
+ </ControlTemplate>
+ </ui:NavigationViewContentPresenter.Template>
+ </ui:NavigationViewContentPresenter>
+
+ <ContentPresenter
+ Grid.Row="0"
+ Grid.RowSpan="2"
+ Margin="0"
+ Content="{TemplateBinding ContentOverlay}" />
+ </Grid>
+ </Grid>
+ </ControlTemplate>
+
+ <!-- Adaptive pane style for MainWindow NavigationView -->
+ <Style
+ x:Key="AdaptivePaneNavigationViewStyle"
+ BasedOn="{StaticResource DefaultNavigationViewStyle}"
+ TargetType="{x:Type ui:NavigationView}">
+ <Style.Triggers>
+ <Trigger Property="PaneDisplayMode" Value="Left">
+ <Setter Property="Template" Value="{StaticResource AdaptiveLeftNavigationViewTemplate}" />
+ <Setter Property="ItemTemplate" Value="{StaticResource AdaptiveLeftCompactNavigationViewItemTemplate}" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+
+ <!-- Scrollable top style for NavigationView -->
+ <Style
+ x:Key="ScrollableTopNavigationViewStyle"
+ BasedOn="{StaticResource DefaultNavigationViewStyle}"
+ TargetType="{x:Type ui:NavigationView}">
+ <Style.Triggers>
+ <Trigger Property="PaneDisplayMode" Value="Top">
+ <Setter Property="Template" Value="{StaticResource ScrollableTopNavigationViewTemplate}" />
+ <Setter Property="ItemTemplate" Value="{StaticResource ScrollableTopCompactNavigationViewItemTemplate}" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+
+</ResourceDictionary>
diff --git a/optimizerDuck/UI/Windows/MainWindow.xaml b/optimizerDuck/UI/Windows/MainWindow.xaml
index 548f32f..9554d5d 100644
--- a/optimizerDuck/UI/Windows/MainWindow.xaml
+++ b/optimizerDuck/UI/Windows/MainWindow.xaml
@@ -35,8 +35,8 @@
IsFooterSeparatorVisible="False"
IsPaneToggleVisible="True"
IsTopSeparatorVisible="False"
- OpenPaneLength="175"
PaneDisplayMode="Left"
+ Style="{StaticResource AdaptivePaneNavigationViewStyle}"
TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}">
<ui:NavigationView.MenuItems>
<controls:FilledNavigationViewItem