<Window x:Class="MainShell.Recipe.View.RecipeNameWindow"
        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:local="clr-namespace:MainShell.Recipe.View"
        xmlns:common="clr-namespace:MainShell.Common"
        mc:Ignorable="d"
        common:WindowService.DialogResult="{Binding DialogResult}"
        Title="RecipeNameWindow"
        ResizeMode="NoResize"
        AllowsTransparency="True"
        WindowStartupLocation="CenterOwner"
        WindowStyle="None"
        Background="Transparent"
        Height="180" Width="380"
        Loaded="Window_Loaded">
    <Border 
            Background="#F8F8F8"
            CornerRadius="10"
            BorderBrush="#E8E8E8"
            BorderThickness="1"
            MouseDown="Window_MouseDown">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock 
            Style="{StaticResource LabelStyle}"
            Text="{DynamicResource CreateRecipe}" 
            HorizontalAlignment="Center"
            FontSize="18" 
            FontFamily="Segoe UI"
            FontWeight="Bold" 
            Foreground="#424A4D" 
            Margin="10,10,0,0"/>
            <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
                <TextBlock Text="请输入新配方的名称：" FontSize="14" VerticalAlignment="Center" Foreground="#555555" Margin="0,0,0,8"/>
                <TextBox x:Name="RecipeNameTextBox" Width="260" Height="34" Padding="10,0" FontSize="15"
                         VerticalContentAlignment="Center" BorderThickness="1" BorderBrush="#CCCCCC"
                         Background="White"
                         Text="{Binding RecipeName, UpdateSourceTrigger=PropertyChanged}"/>
                <TextBlock
    Text="{Binding ValidationMessage}"
    Foreground="Red"
    Margin="4,2,0,0"
    FontSize="12"
    TextWrapping="Wrap">
                    <TextBlock.Style>
                        <Style TargetType="TextBlock">
                            <Setter Property="Visibility" Value="Visible" />
                            <Style.Triggers>
                                <!-- 当 Text 为空时折叠 -->
                                <DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource Self}}" Value="">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </StackPanel>
            <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="20,0,20,20">
                
                <Button Content="确认" IsDefault="True" Style="{StaticResource StartButtonStyle}"
                        Command="{Binding OkCommand}"/>
                <Button Content="取消" IsCancel="True" Style="{StaticResource  CloseButtonStyle}" Margin="0,0,10,0"
        Command="{Binding CancelCommand}"/>
            </StackPanel>
        </Grid>
    </Border>
</Window>
