<dx:ThemedWindow x:Class="VIZ.Package.Module.PageAddWindow"
                 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:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
                 xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
                 xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
                 xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
                 xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:local="clr-namespace:VIZ.Package.Module"
                 d:DataContext="{d:DesignInstance Type=local:PageAddViewModel}" 
                 mc:Ignorable="d" WindowStartupLocation="CenterScreen"
                 Title="添加至播出单" Height="330" Width="600">

    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
    </dxmvvm:Interaction.Behaviors>

    <dx:ThemedWindow.Resources>

        <fcore:Bool2ControlTemplateConverter x:Key="Bool2ControlTemplateConverter_Layer">
            <fcore:Bool2ControlTemplateConverter.TrueResult>
                <ControlTemplate>
                    <dxe:TextEdit EditValue="{Binding Path=LayerIdentifier}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="2,0,2,0" IsReadOnly="True" Background="Transparent">
                        <dxe:TextEdit.ToolTip>
                            <Grid Height="75" MinWidth="220">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"></RowDefinition>
                                    <RowDefinition Height="*"></RowDefinition>
                                    <RowDefinition Height="*"></RowDefinition>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="110"></ColumnDefinition>
                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Row="0" Grid.Column="0" Text="Layer identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
                                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Row.LayerIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
                                <TextBlock Grid.Row="1" Grid.Column="0" Text="State identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
                                <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Row.StateIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
                                <TextBlock Grid.Row="2" Grid.Column="0" Text="Background scene:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
                                <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Row.BackgroundScene,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
                            </Grid>
                        </dxe:TextEdit.ToolTip>
                    </dxe:TextEdit>
                </ControlTemplate>
            </fcore:Bool2ControlTemplateConverter.TrueResult>
            <fcore:Bool2ControlTemplateConverter.FalseResult>
                <ControlTemplate>
                    <dxe:ComboBoxEdit ItemsSource="{Binding Source={x:Static domain:ApplicationConstants.VIZ_LAYERS}}"
                                      EditValue="{Binding Path=Layer,Mode=TwoWay}"
                                      IsTextEditable="False"></dxe:ComboBoxEdit>
                </ControlTemplate>
            </fcore:Bool2ControlTemplateConverter.FalseResult>
        </fcore:Bool2ControlTemplateConverter>

    </dx:ThemedWindow.Resources>

    <Grid Margin="20">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="120"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
        </Grid.RowDefinitions>
        <!-- 场景 -->
        <TextBlock Text="场景:" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"></TextBlock>
        <dxe:TextEdit Grid.Column="1" Height="30" IsReadOnly="True" Background="Transparent"
                      EditValue="{Binding Path=Scene}"></dxe:TextEdit>

        <!-- 备注 -->
        <TextBlock Text="备注:" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"></TextBlock>
        <dxe:TextEdit Grid.Row="1" Grid.Column="1" Height="30"
                      EditValue="{Binding Path=Remark,Mode=TwoWay}"></dxe:TextEdit>

        <!-- 层 -->
        <TextBlock Text="层:" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"></TextBlock>
        <ContentControl Grid.Row="2" Grid.Column="1" Height="30" Template="{Binding Path=TransitionLogic,Converter={StaticResource Bool2ControlTemplateConverter_Layer}}"></ContentControl>

        <!-- 插件 -->
        <TextBlock Text="数据模板:" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"></TextBlock>
        <dxe:ComboBoxEdit Grid.Row="3" Grid.Column="1" Height="30" IsTextEditable="False"
                          ItemsSource="{Binding Path=TemplatePlugins}" DisplayMember="Name"
                          SelectedItem="{Binding Path=SelectedTemplatePlugin,Mode=TwoWay}"></dxe:ComboBoxEdit>

        <!-- 按钮组 -->
        <StackPanel Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
            <Button Width="80" Height="30" Content="確定" Margin="0" Command="{Binding Path=EnterCommand}"></Button>
            <Button Width="80" Height="30" Content="取消" Margin="20,0,0,0" Command="{Binding Path=CancelCommand}"></Button>
        </StackPanel>
    </Grid>

</dx:ThemedWindow>
