修改部分bug

This commit is contained in:
chfei committed 2026-10-28 17:56:50 +08:00
1 parent 499379e20b
commit 3135189ea3
18 files changed
+184 -364

No files matched your search

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Store.Management.Framework.Controls.Attach;
/// <summary>
/// 弹出窗口属性值
/// </summary>
public class DialogWindowProperty
{
public static readonly DependencyProperty WindowStartupLocationProperty = DependencyProperty.RegisterAttached(
"WindowStartupLocation", typeof(WindowStartupLocation), typeof(DialogWindowProperty), new PropertyMetadata(WindowStartupLocation.CenterScreen));
public static void SetWindowStartupLocation(DependencyObject element, WindowStartupLocation value)
=> element.SetValue(WindowStartupLocationProperty, value);
public static WindowStartupLocation GetWindowStartupLocation(DependencyObject element)
=> (WindowStartupLocation)element.GetValue(WindowStartupLocationProperty);
public static readonly DependencyProperty ResizeModeProperty = DependencyProperty.RegisterAttached(
"ResizeMode", typeof(ResizeMode), typeof(DialogWindowProperty), new PropertyMetadata(ResizeMode.CanResize));
public static void SetResizeMode(DependencyObject element, ResizeMode value)
=> element.SetValue(ResizeModeProperty, value);
public static ResizeMode GetResizeMode(DependencyObject element)
=> (ResizeMode)element.GetValue(ResizeModeProperty);
public static readonly DependencyProperty WidthProperty = DependencyProperty.RegisterAttached(
"Width", typeof(double), typeof(DialogWindowProperty), new PropertyMetadata(double.NaN));
public static void SetWidth(DependencyObject element, double value)
=> element.SetValue(WidthProperty, value);
public static double GetWidth(DependencyObject element)
=> (double)element.GetValue(WidthProperty);
public static readonly DependencyProperty HeightProperty = DependencyProperty.RegisterAttached(
"Height", typeof(double), typeof(DialogWindowProperty), new PropertyMetadata(double.NaN));
public static void SetHeight(DependencyObject element, double value)
=> element.SetValue(HeightProperty, value);
public static double GetHeight(DependencyObject element)
=> (double)element.GetValue(HeightProperty);
}
@@ -1,12 +1,13 @@
<local:WindowBase x:Class="Store.Management.Framework.Controls.DialogWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Store.Management.Framework.Controls"
mc:Ignorable="d"
Title="DialogWindow" Height="450" Width="800">
<Grid>
</Grid>
<local:WindowBase
x:Class="Store.Management.Framework.Controls.DialogWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Store.Management.Framework.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="DialogWindow"
Width="800"
Height="450"
mc:Ignorable="d">
<Grid />
</local:WindowBase>
@@ -1,6 +1,4 @@
using MAX.Framework.Controls;
using MAX.Framework.Controls.Attach;
using Prism.Services.Dialogs;
using Store.Management.Framework.Controls;
using Store.Management.Framework.Controls.Attach;
@@ -91,6 +89,8 @@ public partial class DialogWindow : WindowBase, IDialogWindow
if (newContent is UserControl control)
{
WindowStartupLocation = DialogWindowProperty.GetWindowStartupLocation(control);
Setter widthSetter = this.Style.Setters.OfType<Setter>().FirstOrDefault(a => a.Property == WidthProperty);
if (widthSetter == null)
{