#0045 修复算子工具箱边框问题

This commit is contained in:
zhengxuan.zhang
2026-03-26 11:19:51 +08:00
parent 687d0b2a87
commit da66b3e389
6 changed files with 89 additions and 12 deletions
@@ -27,10 +27,41 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 标题 --> <!-- 标题(支持无边框窗口拖拽) -->
<Border Grid.Row="0" Background="#0060A0" Padding="10,8"> <Border x:Name="TitleBar" Grid.Row="0" Background="#0060A0" Padding="10,8">
<TextBlock Text="🧰 算子工具箱" FontFamily="{StaticResource CsdFont}" <Grid>
FontWeight="Bold" FontSize="13" Foreground="White"/> <TextBlock Text="🧰 算子工具箱" FontFamily="{StaticResource CsdFont}"
FontWeight="Bold" FontSize="13" Foreground="White"
VerticalAlignment="Center"/>
<Button x:Name="CloseBtn" HorizontalAlignment="Right" VerticalAlignment="Center"
Content="✕" FontSize="12" Foreground="White" Cursor="Hand"
Visibility="Collapsed"
ToolTip="关闭">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="6,2"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="3" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E04040"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
</Grid>
</Border> </Border>
<!-- 搜索框 --> <!-- 搜索框 -->
@@ -25,8 +25,24 @@ namespace XplorePlane.Views
Loaded += OnLoaded; Loaded += OnLoaded;
} }
/// <summary>
/// 当宿主为无边框窗口时,启用标题栏拖拽和关闭按钮
/// </summary>
private void SetupBorderlessWindowSupport()
{
var hostWindow = Window.GetWindow(this);
if (hostWindow is OperatorToolboxWindow toolboxWindow)
{
TitleBar.MouseLeftButtonDown += toolboxWindow.TitleBar_MouseLeftButtonDown;
CloseBtn.Visibility = Visibility.Visible;
CloseBtn.Click += toolboxWindow.CloseButton_Click;
}
}
private void OnLoaded(object sender, RoutedEventArgs e) private void OnLoaded(object sender, RoutedEventArgs e)
{ {
SetupBorderlessWindowSupport();
ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown; ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown;
ToolboxListBox.PreviewMouseMove += OnPreviewMouseMove; ToolboxListBox.PreviewMouseMove += OnPreviewMouseMove;
_logger?.Debug("OperatorToolboxView 原生拖拽源已注册, DataContext={Type}", _logger?.Debug("OperatorToolboxView 原生拖拽源已注册, DataContext={Type}",
@@ -6,6 +6,14 @@
Width="260" Height="500" Width="260" Height="500"
WindowStartupLocation="CenterOwner" WindowStartupLocation="CenterOwner"
ShowInTaskbar="False" ShowInTaskbar="False"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
ResizeMode="CanResizeWithGrip"> ResizeMode="CanResizeWithGrip">
<views:OperatorToolboxView /> <Border Background="White" BorderBrush="#cdcbcb" BorderThickness="1" CornerRadius="6">
<Border.Effect>
<DropShadowEffect BlurRadius="12" ShadowDepth="2" Opacity="0.3" Color="#333"/>
</Border.Effect>
<views:OperatorToolboxView />
</Border>
</Window> </Window>
@@ -1,4 +1,5 @@
using System.Windows; using System.Windows;
using System.Windows.Input;
namespace XplorePlane.Views namespace XplorePlane.Views
{ {
@@ -8,5 +9,22 @@ namespace XplorePlane.Views
{ {
InitializeComponent(); InitializeComponent();
} }
/// <summary>
/// 允许通过标题栏区域拖动无边框窗口
/// </summary>
public void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 1)
DragMove();
}
/// <summary>
/// 关闭窗口
/// </summary>
public void CloseButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
} }
} }
-5
View File
@@ -375,11 +375,6 @@
<telerik:RadRibbonGroup.Variants> <telerik:RadRibbonGroup.Variants>
<telerik:GroupVariant Priority="0" Variant="Large" /> <telerik:GroupVariant Priority="0" Variant="Large" />
</telerik:RadRibbonGroup.Variants> </telerik:RadRibbonGroup.Variants>
<telerik:RadRibbonButton
Command="{Binding OpenImageProcessingCommand}"
LargeImage="/Assets/Icons/tools.png"
Size="Large"
Text="图像处理" />
<telerik:RadRibbonButton <telerik:RadRibbonButton
Command="{Binding OpenPipelineEditorCommand}" Command="{Binding OpenPipelineEditorCommand}"
LargeImage="/Assets/Icons/workflow.png" LargeImage="/Assets/Icons/workflow.png"
+11 -2
View File
@@ -38,7 +38,17 @@
2026.3.20 2026.3.20
---------------------- ----------------------
1、软件主界面设计讨论,暂定初稿,给出效果图设计 √ 1、软件主界面设计讨论,暂定初稿,给出效果图设计 √
2、日志该用XP.Common库和多语言的学习 2、日志该用XP.Common库和多语言的学习
2026.3.26
----------------------
1、各窗体间数据流的传递,全局数据结构的设计
@@ -51,4 +61,3 @@
TO-DO TO-DO
---------------------- ----------------------
5、各窗体间数据流的传递,全局数据结构的设计