From 6f4e11c7f55d39fc44a955a17d6913ea2ddd52c7 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 21 Feb 2024 22:48:11 +0800 Subject: [PATCH] feat: layout calculation. --- .../ToolBarItemTemplateSelector.cs | 3 +- demo/Ursa.Demo/Pages/ToolBarDemo.axaml | 7 +- demo/Ursa.Demo/Views/MainWindow.axaml.cs | 1 + src/Ursa.Themes.Semi/Controls/ToolBar.axaml | 41 ++++-- src/Ursa/Controls/ToolBar/ToolBar.cs | 22 +++ src/Ursa/Controls/ToolBar/ToolBarPanel.cs | 126 +++++++++++++++--- 6 files changed, 166 insertions(+), 34 deletions(-) diff --git a/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs b/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs index f48b834..76e669b 100644 --- a/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs +++ b/demo/Ursa.Demo/DataTemplates/ToolBarItemTemplateSelector.cs @@ -28,7 +28,6 @@ public class ToolBarItemTemplateSelector: IDataTemplate { [!ContentControl.ContentProperty] = new Binding() { Path = "Content" }, [!ToggleButton.IsCheckedProperty] = new Binding() { Path = "IsChecked" }, - [!Button.CommandProperty] = new Binding() { Path = "Command" }, [!ToolBar.OverflowModeProperty] = new Binding(){ Path = "OverflowMode" } }; } @@ -39,7 +38,7 @@ public class ToolBarItemTemplateSelector: IDataTemplate [!ContentControl.ContentProperty] = new Binding() { Path = "Content" }, [!SelectingItemsControl.SelectedItemProperty] = new Binding() { Path = "SelectedItem" }, [!ItemsControl.ItemsSourceProperty] = new Binding() { Path = "Items" }, - [!ToolBar.OverflowModeProperty] = new Binding(){ Path = "OverflowMode" } + [ToolBar.OverflowModeProperty] = OverflowMode.Always, }; } return new Button() { Content = "Undefined Item" }; diff --git a/demo/Ursa.Demo/Pages/ToolBarDemo.axaml b/demo/Ursa.Demo/Pages/ToolBarDemo.axaml index 61af50f..743ae82 100644 --- a/demo/Ursa.Demo/Pages/ToolBarDemo.axaml +++ b/demo/Ursa.Demo/Pages/ToolBarDemo.axaml @@ -10,15 +10,16 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Ursa.Demo.Pages.ToolBarDemo"> - +