Files
ShrlAlgoToolkit/Melskin/Controls/Modal/ModalWindow.xaml
2026-02-17 22:17:13 +08:00

103 lines
4.0 KiB
XML

<Window
AllowsTransparency="True"
Background="Transparent"
Height="220"
Title="Modal"
Width="400"
WindowStartupLocation="CenterOwner"
WindowStyle="None"
mc:Ignorable="d"
x:Class="Melskin.Controls.ModalWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<Style TargetType="Button" x:Key="ModalButtonStyle">
<Setter Property="Padding" Value="10,5" />
<Setter Property="MinWidth" Value="70" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderCornerLightedGradientBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter
HorizontalAlignment="Center"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E0E0E0" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#D0D0D0" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Border
Background="{DynamicResource BackgroundFloatingBrush}"
BorderBrush="{DynamicResource BorderNormalBrush}"
BorderThickness="1"
CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Title -->
<TextBlock
FontSize="16"
FontWeight="SemiBold"
Foreground="{DynamicResource TextPrimaryBrush}"
Grid.Row="0"
Margin="15,10"
Text="Dialog Title"
x:Name="TitleTextBlock" />
<!-- Content -->
<TextBlock
Foreground="{DynamicResource TextPrimaryBrush}"
Grid.Row="1"
Margin="15,10"
Text="This is the modal content."
TextWrapping="Wrap"
VerticalAlignment="Center"
x:Name="MessageTextBlock" />
<!-- Buttons -->
<StackPanel
Grid.Row="2"
HorizontalAlignment="Right"
Margin="15,10"
Orientation="Horizontal">
<Button
Click="CancelButton_Click"
Content="取消"
Style="{StaticResource ModalButtonStyle}"
x:Name="CancelButton" />
<Button
Click="OkButton_Click"
Content="确定"
IsDefault="True"
Margin="10,0,0,0"
Style="{StaticResource ModalButtonStyle}"
x:Name="OkButton" />
</StackPanel>
</Grid>
</Border>
</Window>