From 49b1ebcd5c028b121b449dcbce414b30155affad Mon Sep 17 00:00:00 2001 From: luxiaoqi Date: Thu, 30 Nov 2023 11:12:09 +0800 Subject: [PATCH] 1 --- CPF.Toolkit/Controls/MdiHost.cs | 43 +++++++++++++++++++++++++++---- CPF.Toolkit/Controls/MdiWindow.cs | 19 +++++++++++--- CPF.Toolkit/Dialogs/DialogView.cs | 3 +++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/CPF.Toolkit/Controls/MdiHost.cs b/CPF.Toolkit/Controls/MdiHost.cs index f052d8d..9d9e985 100644 --- a/CPF.Toolkit/Controls/MdiHost.cs +++ b/CPF.Toolkit/Controls/MdiHost.cs @@ -31,14 +31,47 @@ namespace CPF.Toolkit.Controls ItemsPanel = new StackPanel { Orientation = Orientation.Horizontal }, ItemTemplate = new ListBoxItem { - Height = "100%", Width = 100, MarginRight = 1, FontSize = 16f, BorderFill = "Silver", - BorderThickness = new Thickness(0, 0, 1, 0), + BorderThickness = new Thickness(1), + Margin = new ThicknessField(1), + CornerRadius = new CornerRadius(2), + IsAntiAlias = true, + UseLayoutRounding = true, BorderType = BorderType.BorderThickness, - [nameof(ListBoxItem.Content)] = new BindingDescribe("Title") + ContentTemplate = new ContentTemplate + { + Size = SizeField.Fill, + Content = "test" + //Content = new StackPanel + //{ + // Orientation = Orientation.Horizontal, + // Size = SizeField.Fill, + // Children = + // { + // new TextBlock + // { + // //[nameof(TextBlock.Text)] = new BindingDescribe("Title",BindingMode.OneWay) + // Text = "test" + // } + // } + //}, + }, + //Content = new StackPanel + //{ + // Size = SizeField.Fill, + // Orientation = Orientation.Horizontal, + // Children = + // { + // new TextBlock + // { + // [nameof(TextBlock.Text)] = new BindingDescribe("Title",BindingMode.OneWay) + // } + // } + //}, + //[nameof(ListBoxItem.Content)] = new BindingDescribe("Title") }, Items = this.TaskBarList, [nameof(ListBox.SelectedValue)] = new BindingDescribe(this, nameof(this.SelectWindow), BindingMode.TwoWay), @@ -73,13 +106,13 @@ namespace CPF.Toolkit.Controls case TaskBarPlacement.Top: this.RowDefinitions.Add(new RowDefinition { Height = 35 }); this.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star }); - RowIndex(this.taskBar,0); + RowIndex(this.taskBar, 0); RowIndex(this.host, 1); break; case TaskBarPlacement.Bottom: this.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star }); this.RowDefinitions.Add(new RowDefinition { Height = 35 }); - RowIndex(this.host,0); + RowIndex(this.host, 0); RowIndex(this.taskBar, 1); break; } diff --git a/CPF.Toolkit/Controls/MdiWindow.cs b/CPF.Toolkit/Controls/MdiWindow.cs index e726853..fdbb30b 100644 --- a/CPF.Toolkit/Controls/MdiWindow.cs +++ b/CPF.Toolkit/Controls/MdiWindow.cs @@ -80,7 +80,8 @@ namespace CPF.Toolkit.Controls Size = SizeField.Fill, Background = "white", BorderType = BorderType.BorderStroke, - ShadowBlur = ShadowBlur, + BorderStroke = "0", + //ShadowBlur = ShadowBlur, ShadowColor = Color.FromRgba(0, 0, 0, 150), Child = new Decorator { @@ -420,9 +421,19 @@ namespace CPF.Toolkit.Controls }, }, [nameof(ShadowBlur)] = new BindingDescribe(this, nameof(WindowState), BindingMode.OneWay, x => ((WindowState)x).Or(WindowState.Maximized, WindowState.FullScreen) ? 0 : ShadowBlur), - [nameof(ShadowBlur)] = new BindingDescribe(this, nameof(IsFocused), BindingMode.OneWay, x => ((bool)x) ? ShadowBlur : 0), - [nameof(BorderStroke)] = new BindingDescribe(this, nameof(IsFocused), BindingMode.OneWay, x => ((bool)x) ? "0" : "1"), - [nameof(BorderFill)] = new BindingDescribe(this, nameof(IsFocused), BindingMode.OneWay, x => ((bool)x) ? null : "0,0,0,100"), + Triggers = + { + new Trigger + { + Property = nameof(IsFocused), + Setters = + { + { nameof(ShadowBlur),ShadowBlur }, + { nameof(BorderStroke),"1" }, + { nameof(BorderFill),"0,0,0,100" }, + }, + } + } }); } diff --git a/CPF.Toolkit/Dialogs/DialogView.cs b/CPF.Toolkit/Dialogs/DialogView.cs index 228b57e..47f66d7 100644 --- a/CPF.Toolkit/Dialogs/DialogView.cs +++ b/CPF.Toolkit/Dialogs/DialogView.cs @@ -10,6 +10,7 @@ using CPF.Svg; using System; using System.Collections.Generic; using System.Linq; +using System.Security.Cryptography; using System.Text; namespace CPF.Toolkit.Dialogs @@ -119,6 +120,8 @@ namespace CPF.Toolkit.Dialogs frame.ControlBoxStroke = "black"; frame.CaptionBackgrund = "white"; frame.CaptionForeground = "black"; + frame.MinimizeBox = false; + frame.MaximizeBox = false; textBox.TextChanged += TextBox_TextChanged; }