<ui:ContentDialog
    x:Class="DMS.WPF.Views.Dialogs.TriggerSelectionDialog"
    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:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
    xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
    d:DataContext="{d:DesignInstance vmd:TriggerSelectionDialogViewModel}"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock
            Grid.Row="0"
            Margin="0,0,0,16"
            FontSize="16"
            Text="请选择一个触发器"
            TextWrapping="Wrap" />

        <ListBox
            x:Name="TriggerListBox"
            Grid.Row="1"
            MaxHeight="320"
            ItemsSource="{Binding Triggers}"
            SelectedItem="{Binding SelectedTrigger, Mode=TwoWay}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="4">
                        <TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
                        <TextBlock FontSize="12" Text="{Binding Description}" TextWrapping="Wrap" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <StackPanel
            Grid.Row="2"
            Margin="0,16,0,0"
            HorizontalAlignment="Right"
            Orientation="Horizontal">
            <Button
                Margin="0,0,8,0"
                Command="{Binding ConfirmCommand}"
                Content="确定" />
            <Button
                Command="{Binding CancelCommand}"
                Content="取消" />
        </StackPanel>
    </Grid>
</ui:ContentDialog>