<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Serein.WorkBench.Themes"
    xmlns:sys="clr-namespace:System;assembly=mscorlib">


    <ResourceDictionary.MergedDictionaries>
    </ResourceDictionary.MergedDictionaries>
    
    <Style TargetType="{x:Type local:MethodDetailsControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MethodDetailsControl}">

                    <ItemsControl ItemsSource="{Binding MethodDetails.ExplicitDatas, RelativeSource={RelativeSource TemplatedParent}}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <ContentControl Content="{Binding}">
                                    <ContentControl.Style>
                                        <Style TargetType="ContentControl">
                                            <Style.Triggers>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsExplicitData}" Value="false" />
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="ContentTemplate">
                                                        <Setter.Value>
                                                            <DataTemplate>
                                                                <Grid Background="#E3FDFD">
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition Width="50"/>
                                                                        <ColumnDefinition Width="30"/>
                                                                        <ColumnDefinition Width="50"/>
                                                                        <ColumnDefinition Width="*"/>
                                                                    </Grid.ColumnDefinitions>
                                                                    <TextBlock Grid.Column="0" Text="{Binding Index,StringFormat=agr{0}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                                    <CheckBox  Grid.Column="1" IsChecked="{Binding IsExplicitData, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  VerticalContentAlignment="Center"/>
                                                                    <TextBlock Grid.Column="2" MinWidth="50" Text="{Binding ParameterName}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                                                    <TextBlock Grid.Column="3" MinWidth="50" Text="无须指定参数"/>
                                                                </Grid>
                                                            </DataTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </MultiDataTrigger>

                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsExplicitData}" Value="true" />
                                                        <Condition Binding="{Binding ExplicitTypeName}" Value="Select" />
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="ContentTemplate">
                                                        <Setter.Value>
                                                            <DataTemplate>
                                                                <Grid  Background="#E3FDFD">
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition Width="50"/>
                                                                        <ColumnDefinition Width="30"/>
                                                                        <ColumnDefinition Width="50"/>
                                                                        <ColumnDefinition Width="*"/>
                                                                    </Grid.ColumnDefinitions>
                                                                    <TextBlock Grid.Column="0" Text="{Binding Index,StringFormat=agr{0}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                                    <CheckBox  Grid.Column="1" IsChecked="{Binding IsExplicitData, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  VerticalContentAlignment="Center"/>
                                                                    <TextBlock Grid.Column="2" MinWidth="50" Text="{Binding ParameterName}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                                                    <ComboBox Grid.Column="3"
                                                                              MinWidth="50"
                                                                              ItemsSource="{Binding Items}"
                                                                              SelectedItem="{Binding DataValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                                                </Grid>
                                                            </DataTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </MultiDataTrigger>
                                                
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsExplicitData}" Value="true" />
                                                        <Condition Binding="{Binding ExplicitTypeName}" Value="Value" />
                                                        <!--<Condition Binding="{Binding ExplicitTypeName}" Value="{x:Type sys:String}" />
                                                        <Condition Binding="{Binding ExplicitTypeName}" Value="{x:Type sys:Double}" />-->
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="ContentTemplate">
                                                        <Setter.Value>
                                                            <DataTemplate>
                                                                <Grid  Background="#E3FDFD">
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition Width="50"/>
                                                                        <ColumnDefinition Width="30"/>
                                                                        <ColumnDefinition Width="50"/>
                                                                        <ColumnDefinition Width="*"/>
                                                                    </Grid.ColumnDefinitions>
                                                                    <TextBlock Grid.Column="0" Text="{Binding Index,StringFormat=agr{0}}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                                    <CheckBox  Grid.Column="1" IsChecked="{Binding IsExplicitData, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalContentAlignment="Center"/>
                                                                    <TextBlock Grid.Column="2" MinWidth="50" Text="{Binding ParameterName}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                                                    <TextBox Grid.Column="3" MinWidth="50" Text="{Binding DataValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                                                                </Grid>
                                                            </DataTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </MultiDataTrigger>

                                            </Style.Triggers>
                                        </Style>
                                    </ContentControl.Style>
                                </ContentControl>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
