From 1d7efcd07be197a71a75cdeaa47b6d0359cefd99 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 22 May 2025 17:53:22 +0800 Subject: [PATCH] =?UTF-8?q?rft:=20TooltipBlock=E5=B0=81=E8=A3=85=20(#12773?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * rft: TooltipBlock封装 * fix: TooltipText 绑定失败 * rft: 自动战斗提示替换 --------- Co-authored-by: uye <99072975+ABA2396@users.noreply.github.com> --- .../Styles/Controls/TooltipBlock.xaml | 30 +++++++++++++ .../Styles/Controls/TooltipBlock.xaml.cs | 45 +++++++++++++++++++ src/MaaWpfGui/Views/UI/CopilotView.xaml | 24 +--------- .../VersionUpdateSettingsUserControl.xaml | 22 +-------- 4 files changed, 78 insertions(+), 43 deletions(-) create mode 100644 src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml create mode 100644 src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml.cs diff --git a/src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml b/src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml new file mode 100644 index 0000000000..63184d6220 --- /dev/null +++ b/src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml.cs b/src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml.cs new file mode 100644 index 0000000000..43fe024daa --- /dev/null +++ b/src/MaaWpfGui/Styles/Controls/TooltipBlock.xaml.cs @@ -0,0 +1,45 @@ +// +// MaaWpfGui - A part of the MaaCoreArknights project +// Copyright (C) 2021 MistEO and Contributors +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License v3.0 only as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY +// +#nullable enable +using System.Windows; +using System.Windows.Controls; + +namespace MaaWpfGui.Styles.Controls; + +/// +/// TooltipBlock.xaml 的交互逻辑 +/// +public partial class TooltipBlock : UserControl +{ + public TooltipBlock() + { + InitializeComponent(); + DataContext = this; + } + + public static readonly DependencyProperty TooltipTextProperty = DependencyProperty.Register(nameof(TooltipText), typeof(string), typeof(TooltipBlock), new PropertyMetadata(string.Empty)); + + public static readonly DependencyProperty TooltipMaxWidthProperty = DependencyProperty.Register(nameof(TooltipMaxWidth), typeof(double), typeof(TooltipBlock), new PropertyMetadata(double.MaxValue)); + + public string TooltipText + { + get => (string)GetValue(TooltipTextProperty); + set => SetValue(TooltipTextProperty, value); + } + + public double TooltipMaxWidth + { + get => (double)GetValue(TooltipMaxWidthProperty); + set => SetValue(TooltipMaxWidthProperty, value); + } +} diff --git a/src/MaaWpfGui/Views/UI/CopilotView.xaml b/src/MaaWpfGui/Views/UI/CopilotView.xaml index 864b1320cf..c24a2846cf 100644 --- a/src/MaaWpfGui/Views/UI/CopilotView.xaml +++ b/src/MaaWpfGui/Views/UI/CopilotView.xaml @@ -13,7 +13,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:properties="clr-namespace:MaaWpfGui.Styles.Properties" xmlns:s="https://github.com/canton7/Stylet" - xmlns:styles="clr-namespace:MaaWpfGui.Styles" xmlns:ui="clr-namespace:MaaWpfGui.ViewModels.UI" xmlns:viewModels="clr-namespace:MaaWpfGui.ViewModels" xmlns:vm="clr-namespace:MaaWpfGui" @@ -103,27 +102,8 @@ HorizontalAlignment="Center" Content="{DynamicResource UseCopilotList}" IsChecked="{Binding UseCopilotList}" - IsEnabled="{Binding Idle}"/> - - - - - - + IsEnabled="{Binding Idle}" /> + - - - - - - - +