From 72e57764ec622a9d9f6113928167a9c32966b52c Mon Sep 17 00:00:00 2001 From: zengwenjie <1663900244@qq.com> Date: Mon, 29 Sep 2025 17:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=A0=87=E9=A2=98=E6=A0=8F=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Deedy.Testing/Deedy.Testing.csproj | 10 ++++ DeedyDesigner/Deedy.Testing/Icons/Icon.png | Bin 0 -> 204 bytes .../Deedy.Testing/WindowHeaderTest.xaml | 10 +++- .../Deedy.Testing/WindowHeaderTest.xaml.cs | 5 ++ DeedyDesigner/Deedy.Wpf/Themes/Generic.xaml | 54 +++++++----------- DeedyDesigner/Deedy.Wpf/WindowHeader.cs | 15 ++--- 6 files changed, 46 insertions(+), 48 deletions(-) create mode 100644 DeedyDesigner/Deedy.Testing/Icons/Icon.png diff --git a/DeedyDesigner/Deedy.Testing/Deedy.Testing.csproj b/DeedyDesigner/Deedy.Testing/Deedy.Testing.csproj index 127a1f1..359db83 100644 --- a/DeedyDesigner/Deedy.Testing/Deedy.Testing.csproj +++ b/DeedyDesigner/Deedy.Testing/Deedy.Testing.csproj @@ -8,9 +8,19 @@ true + + + + + + + Never + + + diff --git a/DeedyDesigner/Deedy.Testing/Icons/Icon.png b/DeedyDesigner/Deedy.Testing/Icons/Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5aa8cd9be85983899439d3263d0063312c069a3d GIT binary patch literal 204 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9F5M?jcysy3fAP_WL^ z#WBR=cyfXSD+`0N(ewJf$35Hr|36!xm3QmpkNxLr)tH%`rSgO&{SD3D8MGJ93{d$f z;b-Dt+}s&c+`+n7tcQU+;Irf0-}QUCW|tWmP2h;|xcXuLIor0z#)H!uoG+c+#*kGZ x#b{c<-Bzd4A7yYuCn3egbz|ohgX9!OhUL4Z3?(ORuLQb;!PC{xWt~$(69984MO6R* literal 0 HcmV?d00001 diff --git a/DeedyDesigner/Deedy.Testing/WindowHeaderTest.xaml b/DeedyDesigner/Deedy.Testing/WindowHeaderTest.xaml index 09f0e75..474cb7f 100644 --- a/DeedyDesigner/Deedy.Testing/WindowHeaderTest.xaml +++ b/DeedyDesigner/Deedy.Testing/WindowHeaderTest.xaml @@ -6,10 +6,14 @@ xmlns:local="clr-namespace:Deedy.Testing" xmlns:deedy="clr-namespace:Deedy;assembly=Deedy.Wpf" mc:Ignorable="d" - Title="WindowHeaderTest" Height="450" Width="800" Foreground="White"> + Title="WindowHeaderTest" Height="450" Width="800" Foreground="White" FontSize="18" d:WindowStyle="None" Icon="/Icons/Icon.png"> - - - - - - + + + + diff --git a/DeedyDesigner/Deedy.Wpf/WindowHeader.cs b/DeedyDesigner/Deedy.Wpf/WindowHeader.cs index 0a21444..f8cd9ac 100644 --- a/DeedyDesigner/Deedy.Wpf/WindowHeader.cs +++ b/DeedyDesigner/Deedy.Wpf/WindowHeader.cs @@ -15,8 +15,6 @@ using System.Windows.Shell; namespace Deedy { [ContentProperty("Child")] - [TemplatePart(Name = "IconView", Type = typeof(Border))] - [TemplatePart(Name = "TitleBar", Type = typeof(TextBlock))] [TemplatePart(Name = "Minimize", Type = typeof(Button))] [TemplatePart(Name = "Maximize", Type = typeof(Button))] [TemplatePart(Name = "CloseWin", Type = typeof(Button))] @@ -61,8 +59,6 @@ namespace Deedy private Button? Minimize; private Button? Maximize; private Button? CloseWin; - private TextBlock? TitleBar; - private Border? IconView; private Window? Target; private WindowChrome? Chrome; @@ -102,8 +98,7 @@ namespace Deedy this.Minimize = GetTemplateChild("Minimize") as Button; this.Maximize = GetTemplateChild("Maximize") as Button; this.CloseWin = GetTemplateChild("CloseWin") as Button; - this.IconView = GetTemplateChild("IconView") as Border; - this.TitleBar = GetTemplateChild("TitleBar") as TextBlock; + if (this.Container != null) this.Container.Child = this.Child; } private void Target_Loaded(object sender, RoutedEventArgs e) @@ -115,6 +110,7 @@ namespace Deedy WindowChrome.SetWindowChrome(this.Target, this.Chrome); WindowChrome.SetIsHitTestVisibleInChrome(this.Container, true); WindowChrome.SetIsHitTestVisibleInChrome(this.Controller, true); + if (this.Controller != null) { foreach (var c in this.Controller.Children) @@ -140,12 +136,11 @@ namespace Deedy { if (this.Target != null) { + this.Visibility = Visibility.Visible; if (this.Controller != null) this.Controller.Visibility = Visibility.Visible; if (this.Minimize != null) this.Minimize.Visibility = Visibility.Visible; if (this.Maximize != null) this.Maximize.Visibility = Visibility.Visible; if (this.CloseWin != null) this.CloseWin.Visibility = Visibility.Visible; - if (this.IconView != null) this.IconView.Visibility = Visibility.Visible; - if (this.TitleBar != null) this.TitleBar.Visibility = Visibility.Visible; if (this.Target.ResizeMode == ResizeMode.NoResize) { @@ -158,9 +153,7 @@ namespace Deedy } if (this.Target.WindowStyle == WindowStyle.None) { - if (this.IconView != null) this.IconView.Visibility = Visibility.Collapsed; - if (this.TitleBar != null) this.TitleBar.Visibility = Visibility.Collapsed; - if (this.Controller != null) this.Controller.Visibility = Visibility.Collapsed; + this.Visibility = Visibility.Collapsed; } if (this.Target.WindowStyle == WindowStyle.ToolWindow) {