Files
Shrlalgo.RvKits/NeuWPF/NeoUI/Controls/Modal/ModalWindow.xaml
2025-08-20 12:10:13 +08:00

101 lines
3.7 KiB
XML

<Window
AllowsTransparency="True"
Background="Transparent"
Height="220"
Title="Modal"
Width="400"
WindowStartupLocation="CenterOwner"
WindowStyle="None"
mc:Ignorable="d"
x:Class="NeumUI.Controls.ModalWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:NeumUI.Controls"
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="Background" Value="#F0F0F0" />
<Setter Property="BorderBrush" Value="#D9D9D9" />
<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="White"
BorderBrush="#D9D9D9"
BorderThickness="1"
CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Title -->
<TextBlock
FontSize="16"
FontWeight="SemiBold"
Grid.Row="0"
Margin="15,10"
Text="Dialog Title"
x:Name="TitleTextBlock" />
<!-- Content -->
<TextBlock
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="Cancel"
Style="{StaticResource ModalButtonStyle}"
x:Name="CancelButton" />
<Button
Click="OkButton_Click"
Content="OK"
IsDefault="True"
Margin="10,0,0,0"
Style="{StaticResource ModalButtonStyle}"
x:Name="OkButton" />
</StackPanel>
</Grid>
</Border>
</Window>