From 95901038ccf55335d47b0cffaa1749c8578c8f16 Mon Sep 17 00:00:00 2001
From: keeleycenc <844123814qq.com>
Date: Mon, 4 Nov 2024 21:42:21 +0800
Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=F0=9F=90=9B=20Add=20Snowflake=20Ef?=
=?UTF-8?q?fect=20to=20the=20WPF=20UI=20Gallery?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Introduced a new SnowflakeEffect class and associated Snowflake.cs model to create an interactive snow effect on the UI canvas, responding to mouse movements.
- Updated the GalleryNavigationPresenter.xaml and associated pages in the BasicInput, Collections, DateAndTime, DialogsAndFlyouts, Layout, Media, Navigation, OpSystem, StatusAndInfo, and Text directories to integrate and demonstrate the new snow effect.
- Added new files for the snow effect implementation in the Effects directory: Snowflake.cs and SnowflakeEffect.cs.
- Adjusted page designs in BasicInputPage.xaml, DateAndTimePage.xaml, and other modified pages to accommodate the snow effect visuals and ensure seamless integration.
- Fixed text wrapping issue in navigation cards to improve UI readability and layout consistency.
- Updated themes Dark.xaml and Light.xaml to support the visual requirements of the snow effect.
This update brings a visually engaging element to the WPF UI Gallery, enhancing user interaction with dynamic, responsive snowflakes across multiple demo pages.
---
.../Controls/GalleryNavigationPresenter.xaml | 26 +-
src/Wpf.Ui.Gallery/Effects/Snowflake.cs | 113 +++++++++
src/Wpf.Ui.Gallery/Effects/SnowflakeEffect.cs | 232 ++++++++++++++++++
.../Pages/BasicInput/BasicInputPage.xaml | 61 ++++-
.../Pages/BasicInput/BasicInputPage.xaml.cs | 55 ++++-
.../Pages/BasicInput/ThumbRatePage.xaml.cs | 2 +-
.../Pages/Collections/CollectionsPage.xaml | 61 ++++-
.../Pages/Collections/CollectionsPage.xaml.cs | 55 ++++-
.../Pages/DateAndTime/DateAndTimePage.xaml | 55 ++++-
.../Pages/DateAndTime/DateAndTimePage.xaml.cs | 55 ++++-
.../DialogsAndFlyoutsPage.xaml | 61 ++++-
.../DialogsAndFlyoutsPage.xaml.cs | 55 ++++-
.../Views/Pages/Layout/LayoutPage.xaml | 59 ++++-
.../Views/Pages/Layout/LayoutPage.xaml.cs | 55 ++++-
.../Views/Pages/Media/MediaPage.xaml | 61 ++++-
.../Views/Pages/Media/MediaPage.xaml.cs | 55 ++++-
.../Pages/Navigation/NavigationPage.xaml | 61 ++++-
.../Pages/Navigation/NavigationPage.xaml.cs | 55 ++++-
.../Views/Pages/OpSystem/OpSystemPage.xaml | 59 ++++-
.../Views/Pages/OpSystem/OpSystemPage.xaml.cs | 53 +++-
.../StatusAndInfo/StatusAndInfoPage.xaml | 59 ++++-
.../StatusAndInfo/StatusAndInfoPage.xaml.cs | 55 ++++-
.../Views/Pages/Text/TextPage.xaml | 59 ++++-
.../Views/Pages/Text/TextPage.xaml.cs | 55 ++++-
src/Wpf.Ui/Resources/Theme/Dark.xaml | 3 +
src/Wpf.Ui/Resources/Theme/Light.xaml | 3 +
26 files changed, 1445 insertions(+), 78 deletions(-)
create mode 100644 src/Wpf.Ui.Gallery/Effects/Snowflake.cs
create mode 100644 src/Wpf.Ui.Gallery/Effects/SnowflakeEffect.cs
diff --git a/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml b/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml
index a3f5a5c73..11731a532 100644
--- a/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml
+++ b/src/Wpf.Ui.Gallery/Controls/GalleryNavigationPresenter.xaml
@@ -14,11 +14,18 @@
+
+
+
+
+
+ TextWrapping="Wrap"
+ FontSize="16"/>
+ TextWrapping="Wrap"
+ FontSize="12"/>
-
-
-
-
-
diff --git a/src/Wpf.Ui.Gallery/Effects/Snowflake.cs b/src/Wpf.Ui.Gallery/Effects/Snowflake.cs
new file mode 100644
index 000000000..af09d465c
--- /dev/null
+++ b/src/Wpf.Ui.Gallery/Effects/Snowflake.cs
@@ -0,0 +1,113 @@
+// This Source Code Form is subject to the terms of the MIT License.
+// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
+// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
+// All Rights Reserved.
+
+using System.Windows.Shapes;
+
+namespace Wpf.Ui.Gallery.Effects;
+
+///
+/// Snowflake data model
+///
+internal class SnowFlake
+{
+ private Ellipse? _shape;
+ private double _x;
+ private double _y;
+ private double _size;
+ private double _speed;
+ private double _opacity;
+ private double _velX;
+ private double _velY;
+ private double _stepSize;
+ private double _step;
+ private double _angle;
+ private TranslateTransform? _transform;
+
+ ///
+ /// Gets or sets shape of the snowflake
+ ///
+ public Ellipse? Shape
+ {
+ get => _shape;
+ set => _shape = value;
+ }
+
+ /// Gets or sets x position
+ public double X
+ {
+ get => _x;
+ set => _x = value;
+ }
+
+ /// Gets or sets Y position
+ public double Y
+ {
+ get => _y;
+ set => _y = value;
+ }
+
+ /// Gets or sets Size
+ public double Size
+ {
+ get => _size;
+ set => _size = value;
+ }
+
+ /// Gets or sets Falling speed
+ public double Speed
+ {
+ get => _speed;
+ set => _speed = value;
+ }
+
+ /// Gets or sets Opacity
+ public double Opacity
+ {
+ get => _opacity;
+ set => _opacity = value;
+ }
+
+ /// Gets or sets Horizontal velocity
+ public double VelX
+ {
+ get => _velX;
+ set => _velX = value;
+ }
+
+ /// Gets or sets Vertical velocity
+ public double VelY
+ {
+ get => _velY;
+ set => _velY = value;
+ }
+
+ /// Gets or sets Step size
+ public double StepSize
+ {
+ get => _stepSize;
+ set => _stepSize = value;
+ }
+
+ /// Gets or sets Step
+ public double Step
+ {
+ get => _step;
+ set => _step = value;
+ }
+
+ /// Gets or sets Angle
+ public double Angle
+ {
+ get => _angle;
+ set => _angle = value;
+ }
+
+ /// Gets or sets 2D coordinate transformation
+ public TranslateTransform? Transform
+ {
+ get => _transform;
+ set => _transform = value;
+ }
+}
\ No newline at end of file
diff --git a/src/Wpf.Ui.Gallery/Effects/SnowflakeEffect.cs b/src/Wpf.Ui.Gallery/Effects/SnowflakeEffect.cs
new file mode 100644
index 000000000..b7c646dc6
--- /dev/null
+++ b/src/Wpf.Ui.Gallery/Effects/SnowflakeEffect.cs
@@ -0,0 +1,232 @@
+// This Source Code Form is subject to the terms of the MIT License.
+// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
+// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
+// All Rights Reserved.
+
+using System.Windows.Controls;
+using System.Windows.Shapes;
+
+namespace Wpf.Ui.Gallery.Effects;
+
+///
+/// Snow effect where the snowflakes are blown away by the mouse
+///
+internal class SnowflakeEffect
+{
+ private readonly Canvas _canvas; // Canvas for displaying snowflakes
+ private readonly Random _random = new(); // Random number generator
+ private readonly List _snowFlakes = []; // Stores all snowflake objects
+ private readonly int _flakeCount; // Number of snowflakes
+ private double mX = -100; // Mouse X-coordinate, default value -100
+ private double mY = -100; // Mouse Y-coordinate, default value -100
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The canvas where the effect is applied.
+ /// The number of snowflakes.
+ public SnowflakeEffect(Canvas canvas, int flakeCount = 188)
+ {
+ _canvas = canvas;
+ _flakeCount = flakeCount;
+ InitSnowFlakes();
+
+ if (_canvas.Parent is FrameworkElement parentElement)
+ {
+ parentElement.MouseMove += OnMouseMove;
+ parentElement.SizeChanged += OnSizeChanged;
+ }
+ }
+
+ ///
+ /// Starts displaying the snowflake effect
+ ///
+ public void Start()
+ {
+ CompositionTarget.Rendering += UpdateSnowFlakes;
+ }
+
+ ///
+ /// Stops displaying the snowflake effect and cleans up resources
+ ///
+ public void Stop()
+ {
+ CompositionTarget.Rendering -= UpdateSnowFlakes;
+ ClearSnowFlakes();
+
+ if (_canvas.Parent is FrameworkElement parentElement)
+ {
+ parentElement.MouseMove -= OnMouseMove;
+ parentElement.SizeChanged -= OnSizeChanged;
+ }
+
+ _canvas.Children.Clear();
+ }
+
+ ///
+ /// Initializes snowflake objects
+ ///
+ private void InitSnowFlakes()
+ {
+ for (int i = 0; i < _flakeCount; i++)
+ {
+ CreateSnowFlake();
+ }
+ }
+
+ ///
+ /// Creates a single snowflake and adds it to the canvas
+ ///
+ private void CreateSnowFlake()
+ {
+ double size = (_random.NextDouble() * 3) + 2; // Snowflake size
+ double speed = (_random.NextDouble() * 1) + 0.5; // Falling speed
+ double opacity = (_random.NextDouble() * 0.5) + 0.3; // Opacity
+ double x = _random.NextDouble() * _canvas.ActualWidth; // Initial X position
+ double y = _random.NextDouble() * _canvas.ActualHeight; // Initial Y position
+
+ Ellipse flakeShape = new()
+ {
+ Width = size,
+ Height = size,
+ Fill = new SolidColorBrush(Color.FromArgb((byte)(opacity * 255), 255, 255, 255))
+ };
+
+ TranslateTransform transform = new(x, y);
+ flakeShape.RenderTransform = transform;
+
+ _ = _canvas.Children.Add(flakeShape);
+
+ SnowFlake flake = new()
+ {
+ Shape = flakeShape,
+ X = x,
+ Y = y,
+ Size = size,
+ Speed = speed,
+ Opacity = opacity,
+ VelX = 0,
+ VelY = speed,
+ StepSize = _random.NextDouble() / 30 * 1,
+ Step = 0,
+ Angle = 180,
+ Transform = transform
+ };
+
+ _snowFlakes.Add(flake);
+ }
+
+ ///
+ /// Updates the position of snowflakes to respond to mouse movements
+ ///
+ private void UpdateSnowFlakes(object? sender, EventArgs e)
+ {
+ if (_canvas.ActualWidth == 0 || _canvas.ActualHeight == 0)
+ {
+ return;
+ }
+
+ foreach (SnowFlake flake in _snowFlakes)
+ {
+ double x = mX;
+ double y = mY;
+ double minDist = 150;
+ double x2 = flake.X;
+ double y2 = flake.Y;
+
+ double dist = Math.Sqrt(((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y)));
+
+ if (dist < minDist)
+ {
+ double force = minDist / (dist * dist);
+ double xcomp = (x - x2) / dist;
+ double ycomp = (y - y2) / dist;
+ double deltaV = force / 2;
+
+ flake.VelX -= deltaV * xcomp;
+ flake.VelY -= deltaV * ycomp;
+ }
+ else
+ {
+ flake.VelX *= 0.98;
+ if (flake.VelY <= flake.Speed)
+ {
+ flake.VelY = flake.Speed;
+ }
+
+ flake.VelX += Math.Cos(flake.Step += 0.05) * flake.StepSize;
+ }
+
+ flake.Y += flake.VelY;
+ flake.X += flake.VelX;
+
+ if (flake.Y >= _canvas.ActualHeight || flake.Y <= 0)
+ {
+ ResetFlake(flake);
+ }
+
+ if (flake.X >= _canvas.ActualWidth || flake.X <= 0)
+ {
+ ResetFlake(flake);
+ }
+
+ flake.Transform!.SetCurrentValue(TranslateTransform.XProperty, flake.X);
+ flake.Transform!.SetCurrentValue(TranslateTransform.YProperty, flake.Y);
+ }
+ }
+
+ ///
+ /// Resets the position and properties of a snowflake when it moves out of view
+ ///
+ private void ResetFlake(SnowFlake flake)
+ {
+ flake.X = _random.NextDouble() * _canvas.ActualWidth;
+ flake.Y = 0;
+ flake.Size = (_random.NextDouble() * 3) + 2;
+ flake.Speed = (_random.NextDouble() * 1) + 0.5;
+ flake.VelY = flake.Speed;
+ flake.VelX = 0;
+ flake.Opacity = (_random.NextDouble() * 0.5) + 0.3;
+
+ if (flake.Shape == null)
+ {
+ return;
+ }
+
+ flake.Shape.SetCurrentValue(FrameworkElement.WidthProperty, flake.Size);
+ flake.Shape.SetCurrentValue(FrameworkElement.HeightProperty, flake.Size);
+ flake.Shape.SetCurrentValue(Shape.FillProperty, new SolidColorBrush(Color.FromArgb((byte)(flake.Opacity * 255), 255, 255, 255)));
+ }
+
+ ///
+ /// Cleans up all snowflakes, used when stopping the effect
+ ///
+ private void ClearSnowFlakes()
+ {
+ foreach (SnowFlake flake in _snowFlakes)
+ {
+ _canvas.Children.Remove(flake.Shape);
+ }
+
+ _snowFlakes.Clear();
+ }
+
+ ///
+ /// Mouse move event handler, updates mouse position
+ ///
+ private void OnMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
+ {
+ Point position = e.GetPosition(_canvas);
+ mX = position.X;
+ mY = position.Y;
+ }
+
+ ///
+ /// Canvas size change event handler, updates canvas dimensions
+ ///
+ private void OnSizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ _canvas.SetCurrentValue(FrameworkElement.WidthProperty, e.NewSize.Width);
+ _canvas.SetCurrentValue(FrameworkElement.HeightProperty, e.NewSize.Height);
+ }
+}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml
index f317cbefe..d4ae96b85 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml
@@ -1,4 +1,4 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml.cs
index 9a75a1a19..f97f132cf 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/BasicInputPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.BasicInput;
namespace Wpf.Ui.Gallery.Views.Pages.BasicInput;
public partial class BasicInputPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public BasicInputViewModel ViewModel { get; }
- public BasicInputPage(BasicInputViewModel viewModel)
+ public BasicInputPage(BasicInputViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ThumbRatePage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ThumbRatePage.xaml.cs
index 6c71801a0..ea1060ef3 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ThumbRatePage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ThumbRatePage.xaml.cs
@@ -1,4 +1,4 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml
index 109c0120b..33de71ff4 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml
@@ -1,4 +1,4 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml.cs
index 2074b5a0f..143c964ad 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Collections/CollectionsPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.Collections;
namespace Wpf.Ui.Gallery.Views.Pages.Collections;
public partial class CollectionsPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public CollectionsViewModel ViewModel { get; }
- public CollectionsPage(CollectionsViewModel viewModel)
+ public CollectionsPage(CollectionsViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml
index 21c44bea2..9dde2cf77 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml
@@ -18,10 +18,59 @@
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml.cs
index 186e51bc1..01b5860d8 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/DateAndTime/DateAndTimePage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.DateAndTime;
namespace Wpf.Ui.Gallery.Views.Pages.DateAndTime;
public partial class DateAndTimePage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public DateAndTimeViewModel ViewModel { get; }
- public DateAndTimePage(DateAndTimeViewModel viewModel)
+ public DateAndTimePage(DateAndTimeViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml
index d8b4e68c9..4e5d13353 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml
@@ -1,4 +1,4 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml.cs
index 66a162779..6edb40ff4 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/DialogsAndFlyouts/DialogsAndFlyoutsPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.DialogsAndFlyouts;
namespace Wpf.Ui.Gallery.Views.Pages.DialogsAndFlyouts;
public partial class DialogsAndFlyoutsPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public DialogsAndFlyoutsViewModel ViewModel { get; }
- public DialogsAndFlyoutsPage(DialogsAndFlyoutsViewModel viewModel)
+ public DialogsAndFlyoutsPage(DialogsAndFlyoutsViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml
index bed1fd81e..d0f222415 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml
@@ -19,8 +19,59 @@
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml.cs
index c5a7469e7..921cea37a 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Layout/LayoutPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.Layout;
namespace Wpf.Ui.Gallery.Views.Pages.Layout;
public partial class LayoutPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public LayoutViewModel ViewModel { get; }
- public LayoutPage(LayoutViewModel viewModel)
+ public LayoutPage(LayoutViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml
index 5ae36f1ae..b5723c5ec 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml
@@ -1,4 +1,4 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml.cs
index eca975ecc..61b853a06 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Media/MediaPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.Media;
namespace Wpf.Ui.Gallery.Views.Pages.Media;
public partial class MediaPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public MediaViewModel ViewModel { get; }
- public MediaPage(MediaViewModel viewModel)
+ public MediaPage(MediaViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml
index 7927e872d..d65f4e0ac 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml
@@ -1,4 +1,4 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml.cs
index 4e7a292b8..43e728122 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Navigation/NavigationPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.Navigation;
namespace Wpf.Ui.Gallery.Views.Pages.Navigation;
public partial class NavigationPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public NavigationViewModel ViewModel { get; }
- public NavigationPage(NavigationViewModel viewModel)
+ public NavigationPage(NavigationViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml
index 79697b470..96eabd63d 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml
@@ -17,8 +17,59 @@
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml.cs
index c5e3a0a96..5f3dda07c 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/OpSystem/OpSystemPage.xaml.cs
@@ -4,19 +4,70 @@
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.OpSystem;
namespace Wpf.Ui.Gallery.Views.Pages.OpSystem;
public partial class OpSystemPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public OpSystemViewModel ViewModel { get; }
- public OpSystemPage(OpSystemViewModel viewModel)
+ public OpSystemPage(OpSystemViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml
index c1be5510c..2901b2e83 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml
@@ -19,8 +19,59 @@
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml.cs
index ac4a78c7f..57bba04ab 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/StatusAndInfo/StatusAndInfoPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.StatusAndInfo;
namespace Wpf.Ui.Gallery.Views.Pages.StatusAndInfo;
public partial class StatusAndInfoPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public StatusAndInfoViewModel ViewModel { get; }
- public StatusAndInfoPage(StatusAndInfoViewModel viewModel)
+ public StatusAndInfoPage(StatusAndInfoViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml
index 6a80fb655..2b0a685af 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml
@@ -17,8 +17,59 @@
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly. Library changes the base elements like Page, ToggleButton or List, and also includes additional controls like Navigation, NumberBox, Dialog or Snackbar.
+
+
+ Support the development of WPF UI and other innovative projects by becoming a sponsor on GitHub! Your monthly or one-time contributions help us continue to deliver high-quality, open-source solutions that empower developers worldwide.
+
+
+
+
+
+
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml.cs
index 37d073ac7..cac96652f 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Text/TextPage.xaml.cs
@@ -1,22 +1,73 @@
-// This Source Code Form is subject to the terms of the MIT License.
+// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using Wpf.Ui.Controls;
+using Wpf.Ui.Gallery.Effects;
using Wpf.Ui.Gallery.ViewModels.Pages.Text;
namespace Wpf.Ui.Gallery.Views.Pages.Text;
public partial class TextPage : INavigableView
{
+ private readonly INavigationService _navigationService;
+ private SnowflakeEffect? _snowflake;
+
public TextViewModel ViewModel { get; }
- public TextPage(TextViewModel viewModel)
+ public TextPage(TextViewModel viewModel, INavigationService navigationService)
{
ViewModel = viewModel;
DataContext = this;
+ _navigationService = navigationService;
InitializeComponent();
+ Loaded += HandleLoaded;
+ Unloaded += HandleUnloaded;
+ }
+
+ private void HandleLoaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Collapsed)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
+ }
+
+ INavigationViewItem? selectedItem = navigationControl?.SelectedItem;
+ if (selectedItem != null)
+ {
+ string? newTitle = selectedItem.Content?.ToString();
+ if (MainTitle.Text != newTitle)
+ {
+ MainTitle.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, newTitle);
+ }
+
+ if (selectedItem.Icon is SymbolIcon selectedIcon &&
+ MainSymbolIcon.Symbol != selectedIcon.Symbol)
+ {
+ MainSymbolIcon.SetCurrentValue(SymbolIcon.SymbolProperty, selectedIcon.Symbol);
+ }
+ }
+
+ _snowflake ??= new(MainCanvas);
+ _snowflake.Start();
+ }
+
+ private void HandleUnloaded(object sender, RoutedEventArgs e)
+ {
+ INavigationView? navigationControl = _navigationService.GetNavigationControl();
+ if (navigationControl?.BreadcrumbBar != null &&
+ navigationControl.BreadcrumbBar.Visibility != Visibility.Visible)
+ {
+ navigationControl.BreadcrumbBar.SetCurrentValue(VisibilityProperty, Visibility.Visible);
+ }
+
+ _snowflake?.Stop();
+ _snowflake = null;
+ Loaded -= HandleLoaded;
+ Unloaded -= HandleUnloaded;
}
}
diff --git a/src/Wpf.Ui/Resources/Theme/Dark.xaml b/src/Wpf.Ui/Resources/Theme/Dark.xaml
index 5a8200d85..77c105868 100644
--- a/src/Wpf.Ui/Resources/Theme/Dark.xaml
+++ b/src/Wpf.Ui/Resources/Theme/Dark.xaml
@@ -102,6 +102,9 @@
#09FFFFFF
#09FFFFFF
+ #171C26
+ #00000000
+
#2C2C2C
diff --git a/src/Wpf.Ui/Resources/Theme/Light.xaml b/src/Wpf.Ui/Resources/Theme/Light.xaml
index a8288560c..61fd61064 100644
--- a/src/Wpf.Ui/Resources/Theme/Light.xaml
+++ b/src/Wpf.Ui/Resources/Theme/Light.xaml
@@ -102,6 +102,9 @@
#40FFFFFF
#40FFFFFF
+ #2E4053
+ #CCCCCC
+
#F9F9F9