From f67a5a313cc3de10e21897666ae4ff842a932c75 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 14 Feb 2024 01:25:21 +0800 Subject: [PATCH] feat: add toggle registration. --- demo/Ursa.Demo/Pages/NavMenuDemo.axaml | 87 ++++++++++++++------- src/Ursa.Themes.Semi/Controls/NavMenu.axaml | 3 + src/Ursa/Controls/NavMenu/NavMenu.cs | 30 +++++++ 3 files changed, 93 insertions(+), 27 deletions(-) diff --git a/demo/Ursa.Demo/Pages/NavMenuDemo.axaml b/demo/Ursa.Demo/Pages/NavMenuDemo.axaml index ad61228..72a2f89 100644 --- a/demo/Ursa.Demo/Pages/NavMenuDemo.axaml +++ b/demo/Ursa.Demo/Pages/NavMenuDemo.axaml @@ -2,34 +2,50 @@ x:Class="Ursa.Demo.Pages.NavMenuDemo" xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converters="clr-namespace:Ursa.Demo.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:u="https://irihi.tech/ursa" xmlns:vm="using:Ursa.Demo.ViewModels" - xmlns:converters="clr-namespace:Ursa.Demo.Converters" d:DesignHeight="450" d:DesignWidth="800" x:CompileBindings="True" x:DataType="vm:NavMenuDemoViewModel" mc:Ignorable="d"> - + - - Collapse - - + + + Collapse + + + - @@ -37,26 +53,43 @@ - + ActiveStrokeBrush="{DynamicResource SemiBlue5}" + Data="{Binding Converter={StaticResource IconConverter}}" + Foreground="{DynamicResource SemiGrey5}" + IsActive="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=u:NavMenuItem}, Path=IsHighlighted, Mode=TwoWay}" + StrokeBrush="{DynamicResource SemiGrey5}" /> - - - + + + + + + - - + + - - - + + + diff --git a/src/Ursa.Themes.Semi/Controls/NavMenu.axaml b/src/Ursa.Themes.Semi/Controls/NavMenu.axaml index d174423..b8196a7 100644 --- a/src/Ursa.Themes.Semi/Controls/NavMenu.axaml +++ b/src/Ursa.Themes.Semi/Controls/NavMenu.axaml @@ -128,6 +128,9 @@