XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEToolBox

【WPF】XFE工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
using System.Windows;
using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using XFEToolBox.Client.Views.Windows;

namespace XFEToolBox.Client.ViewModel.Windows;

public partial class PopupWindowViewModel(PopupWindow viewPage) : ObservableObject
{
    [ObservableProperty]
    object? content;
    [ObservableProperty]
    string popupTitle = string.Empty;
    [ObservableProperty]
    string popupSubtitle = string.Empty;
    [ObservableProperty]
    Thickness contentMargin = new(0, 0, 0, 15);
    [ObservableProperty]
    Brush popupBackground = new SolidColorBrush(Color.FromRgb(152, 152, 231));
    [ObservableProperty]
    Brush popupContentBackground = new SolidColorBrush(Colors.White);
    [ObservableProperty]
    Visibility closeButtonVisibility = Visibility.Visible;
    [ObservableProperty]
    Visibility moveButtonVisibility = Visibility.Visible;

    public PopupWindow ViewPage { get; set; } = viewPage;

    public GridLength HeaderGridLength => string.IsNullOrWhiteSpace(PopupTitle) && string.IsNullOrWhiteSpace(PopupSubtitle)
        ? new GridLength(0)
        : new GridLength(42);

    partial void OnPopupTitleChanged(string value) => OnPropertyChanged(nameof(HeaderGridLength));

    partial void OnPopupSubtitleChanged(string value) => OnPropertyChanged(nameof(HeaderGridLength));
}