<ui:ContentDialog
    x:Class="DMS.WPF.Views.Dialogs.EmailTemplateDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
    xmlns:hc="https://handyorg.github.io/handycontrol"
    xmlns:vm="clr-namespace:DMS.WPF.ViewModels.Dialogs"
    Title="{Binding DialogTitle}"
    d:DataContext="{d:DesignInstance Type=vm:EmailTemplateDialogViewModel}"
    CloseButtonCommand="{Binding CancelCommand}"
    CloseButtonText="取消"
    DefaultButton="Primary"
    PrimaryButtonCommand="{Binding SaveCommand}"
    PrimaryButtonText="保存"
    mc:Ignorable="d">

    <ui:ContentDialog.Resources>
        <Style x:Key="LabelStyle" TargetType="TextBlock">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Right" />
            <Setter Property="Margin" Value="0,0,10,0" />
        </Style>
    </ui:ContentDialog.Resources>

    <ScrollViewer Margin="16">
        <StackPanel>
            <!-- 模板名称 -->
            <hc:TextBox hc:InfoElement.Title="模板名称:" 
                        Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" 
                        Margin="0,0,0,15"/>

            <!-- 模板代码 -->
            <hc:TextBox hc:InfoElement.Title="模板代码:" 
                        Text="{Binding Code, UpdateSourceTrigger=PropertyChanged}" 
                        Margin="0,0,0,15"/>

            <!-- 邮件主题 -->
            <hc:TextBox hc:InfoElement.Title="邮件主题:" 
                        Text="{Binding Subject, UpdateSourceTrigger=PropertyChanged}" 
                        Margin="0,0,0,15"/>

            <!-- 邮件内容 -->
            <TextBlock Text="邮件内容:" Margin="0,0,0,5" />
            <hc:TextBox Text="{Binding Body, UpdateSourceTrigger=PropertyChanged}" 
                        AcceptsReturn="True" 
                        TextWrapping="Wrap" 
                        Height="150"
                        Margin="0,0,0,15" />

            <!-- HTML格式 -->
            <CheckBox Content="HTML格式" 
                      IsChecked="{Binding IsHtml}" 
                      Margin="0,0,0,15"/>

            <!-- 启用 -->
            <CheckBox Content="启用" 
                      IsChecked="{Binding IsActive}" 
                      Margin="0,0,0,15"/>
        </StackPanel>
    </ScrollViewer>
</ui:ContentDialog>