<Window x:Class="AIStudio.Wpf.DiagramDesigner.Test.MainWindow"
        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:AIStudio.Wpf.DiagramDesigner.Test"
        xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"      
        xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/Themes/FlowNode.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ComboBox.xaml" />
                <ResourceDictionary>
                    <!-- Accent colors -->
                    <Color x:Key="Fluent.Ribbon.Colors.AccentBaseColor">#FF0078D7</Color>
                    <!--80%-->
                    <Color x:Key="Fluent.Ribbon.Colors.AccentColor80">#CC0078D7</Color>
                    <!--60%-->
                    <Color x:Key="Fluent.Ribbon.Colors.AccentColor60">#990078D7</Color>
                    <!--40%-->
                    <Color x:Key="Fluent.Ribbon.Colors.AccentColor40">#660078D7</Color>
                    <!--20%-->
                    <Color x:Key="Fluent.Ribbon.Colors.AccentColor20">#330078D7</Color>
                    <Color x:Key="Fluent.Ribbon.Colors.HighlightColor">#FF086F9E</Color>
                    <Color x:Key="BlackColor">#FF000000</Color>
                    <Color x:Key="BlackColor20">#51000000</Color>
                    <Color x:Key="WhiteColor">#FFFFFFFF</Color>
                    <Color x:Key="WhiteColor20">#51FFFFFF</Color>
                    <Color x:Key="Gray1">#FF333333</Color>
                    <Color x:Key="Gray2">#FF7F7F7F</Color>
                    <Color x:Key="Gray3">#FF9D9D9D</Color>
                    <Color x:Key="Gray4">#FFA59F93</Color>
                    <Color x:Key="Gray5">#FFB9B9B9</Color>
                    <Color x:Key="Gray6">#FFCCCCCC</Color>
                    <Color x:Key="Gray7">#FFD8D8D9</Color>
                    <Color x:Key="Gray8">#FFE0E0E0</Color>
                    <Color x:Key="Gray9">#5EC9C9C9</Color>
                    <Color x:Key="Gray10">#FFF7F7F7</Color>
                    <Color x:Key="TransparentWhiteColor">#00FFFFFF</Color>
                    <Color x:Key="Fluent.Ribbon.Colors.HighTransparentWhiteColor">#17FFFFFF</Color>

                    <!-- Accent brushes -->
                    <SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentBaseColorBrush" Color="{StaticResource Fluent.Ribbon.Colors.AccentBaseColor}" options:Freeze="True" />
                    <SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush80" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor80}" options:Freeze="True" />
                    <SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush60" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor60}" options:Freeze="True" />
                    <SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush40" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor40}" options:Freeze="True" />
                    <SolidColorBrush x:Key="Fluent.Ribbon.Brushes.AccentColorBrush20" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor20}" options:Freeze="True" />
                    <SolidColorBrush x:Key="Fluent.Ribbon.Brushes.HighlightBrush" Color="{StaticResource Fluent.Ribbon.Colors.HighlightColor}" options:Freeze="True" />
                    <SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource WhiteColor}" options:Freeze="True" />
                    <SolidColorBrush x:Key="WhiteBrush20" Color="{StaticResource WhiteColor20}" options:Freeze="True" />
                    <SolidColorBrush x:Key="BlackBrush" Color="{StaticResource BlackColor}" options:Freeze="True" />
                    <SolidColorBrush x:Key="BlackBrush20" Color="{StaticResource BlackColor20}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush1" Color="{StaticResource Gray1}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush2" Color="{StaticResource Gray2}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush3" Color="{StaticResource Gray3}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush4" Color="{StaticResource Gray4}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush5" Color="{StaticResource Gray5}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush6" Color="{StaticResource Gray6}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush7" Color="{StaticResource Gray7}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush8" Color="{StaticResource Gray8}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush9" Color="{StaticResource Gray9}" options:Freeze="True" />
                    <SolidColorBrush x:Key="GrayBrush10" Color="{StaticResource Gray10}" options:Freeze="True" />
                    <SolidColorBrush x:Key="Fluent.Ribbon.Brushes.Button.MouseOver.Background" Color="{StaticResource Fluent.Ribbon.Colors.AccentColor20}" options:Freeze="True" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <TabControl>
        <TabItem Header="Custom" >
            <Grid x:Name="grid">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <!-- ToolBox Control -->
                <dd:ToolBoxControl Grid.Column="0"  />

                <GridSplitter Grid.Column="1"
						  HorizontalAlignment="Left"
						  VerticalAlignment="Stretch"
						  Background="Transparent"
						  Width="3" />

                <!-- Diagram Control -->
                <dd:DiagramControl Grid.Column="1" x:Name="diagram" DataContext="{Binding TabItem1ViewModel.DiagramViewModel}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

                <dd:PropertiesView Grid.Column="2" CustomSetting="True" SelectedObject="{Binding TabItem1ViewModel.SelectedItem}" Width="200">
                    <dd:PropertiesView.Resources>

                        <Style x:Key="ActTypeStyle" TargetType="{x:Type ContentControl}">
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
                                            <ComboBox BorderThickness="0" Text="{Binding ActType}" Style="{StaticResource ComboBoxStyle}">
                                                <ComboBoxItem Content="or"/>
                                                <ComboBoxItem Content="and"/>
                                            </ComboBox>
                                        </Grid>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                        <Style x:Key="UserIdsStyle" TargetType="{x:Type ContentControl}">
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
                                            <dd:MultiSelectComboBox BorderThickness="0" DisplayMemberPath="text" SelectedValuePath="value"
                                        SelectedValues="{Binding UserIds}"
                                        ItemsSource="{Binding Path=DataContext.TabItem1ViewModel.Users,RelativeSource={RelativeSource AncestorType={x:Type Window}}}"  ></dd:MultiSelectComboBox>
                                        </Grid>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                        <Style x:Key="RoleIdsStyle" TargetType="{x:Type ContentControl}">
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}">
                                            <dd:MultiSelectComboBox BorderThickness="0" DisplayMemberPath="text" SelectedValuePath="value"
                                        SelectedValues="{Binding RoleIds}"
                                        ItemsSource="{Binding Path=DataContext.TabItem1ViewModel.Roles,RelativeSource={RelativeSource AncestorType={x:Type Window}}}"></dd:MultiSelectComboBox>
                                        </Grid>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </dd:PropertiesView.Resources>
                </dd:PropertiesView>

            </Grid>
        </TabItem>
        <TabItem Header="Flowchart" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>                      
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <TextBox Text="{Binding TabItem2ViewModel.InputData}" 
                             TextWrapping="Wrap" 
                             AcceptsReturn="True"
                             VerticalScrollBarVisibility="Auto" 
                             Height="50"/>
                    <Button Grid.Column="1" Content="加载数据" Command="{Binding TabItem2ViewModel.SetDataCommand}"/>
                    <Button Grid.Column="2" Content="获取数据" Command="{Binding TabItem2ViewModel.GetDataCommand}"/>
                    <TextBox Grid.Column="3" Text="{Binding TabItem2ViewModel.OutputData}" 
                             TextWrapping="Wrap" 
                             AcceptsReturn="True"
                             VerticalScrollBarVisibility="Auto" 
                             Height="50"/>
                   
                </Grid>
                <dd:FlowchartEditor Grid.Row="1" Data="{Binding TabItem2ViewModel.Data}" 
                                    GetDataFunc="{Binding TabItem2ViewModel.GetDataFunc,Mode=OneWayToSource}"
                                    Users="{Binding TabItem2ViewModel.Users}" 
                                    Roles="{Binding TabItem2ViewModel.Roles}">
                </dd:FlowchartEditor>
            </Grid>

        </TabItem>
    </TabControl>
</Window>
