<Window
  x:Class="VPet.ModMaker.Views.ModEdit.AnimeEdit.FoodAnimeEditWindow"
  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:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
  xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.AnimeEdit"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:pu="https://opensource.panuon.com/wpf-ui"
  xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit.AnimeEdit"
  Title="{ll:Str 编辑动画}"
  Width="1000"
  Height="600"
  d:DataContext="{d:DesignInstance Type=vm:FoodAnimeEditWindowVM}"
  WindowStartupLocation="CenterScreen"
  mc:Ignorable="d">
  <Window.Resources>
    <Style
      x:Key="ListBoxItem_Style"
      BasedOn="{StaticResource {x:Type ListBoxItem}}"
      TargetType="ListBoxItem">
      <Setter Property="HorizontalContentAlignment" Value="Stretch" />
      <Setter Property="VerticalContentAlignment" Value="Stretch" />
    </Style>
    <DataTemplate x:Key="Expander_AnimeItem" DataType="Expander">
      <Expander
        HorizontalAlignment="Stretch"
        VerticalAlignment="Top"
        d:DataContext=""
        Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}">
        <Expander.ContextMenu>
          <ContextMenu d:DataContext="">
            <MenuItem
              d:Header="添加图片"
              Command="{Binding PlacementTarget.Tag.AddImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
              CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
              Header="{ll:Str 添加图片}"
              IsEnabled="{Binding PlacementTarget.Tag.PlayCommand.CurrentCanExecute.Value, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}" />
            <MenuItem
              d:Header="添加图片"
              Command="{Binding PlacementTarget.Tag.ClearImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
              CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
              Header="{ll:Str 清空图片}"
              IsEnabled="{Binding PlacementTarget.Tag.PlayCommand.CurrentCanExecute.Value, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}" />
            <MenuItem
              d:Header="添加图片"
              Command="{Binding PlacementTarget.Tag.RemoveAnimeCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
              CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
              Header="{ll:Str 删除此项}"
              IsEnabled="{Binding PlacementTarget.Tag.PlayCommand.CurrentCanExecute.Value, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}" />
          </ContextMenu>
        </Expander.ContextMenu>
        <Expander.Header>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" MinWidth="200" />
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <!--<TextBlock Margin="10,0,10,0">
              <TextBlock.Text>
                <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})">
                  <Binding Path="Images.Count" />
                </MultiBinding>
              </TextBlock.Text>
            </TextBlock>-->
            <TextBox Grid.Column="1" Text="{Binding Id.Value, UpdateSourceTrigger=PropertyChanged}" />
            <!--  pu:TextBoxHelper.Watermark="{ll:Str 动画Id(非必要)}"  -->
          </Grid>
        </Expander.Header>
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" MinWidth="200" />
          </Grid.ColumnDefinitions>
          <Grid>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <GroupBox>
              <GroupBox.Header>
                <StackPanel Orientation="Horizontal">
                  <Label d:Content="顶层图片" Content="{ll:Str 顶层图片}" />
                  <TextBlock Margin="10,0,0,0">
                    <TextBlock.Text>
                      <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})">
                        <Binding Path="FrontImages.Count" />
                      </MultiBinding>
                    </TextBlock.Text>
                  </TextBlock>
                </StackPanel>
              </GroupBox.Header>
              <ListBox
                d:ItemsSource="{d:SampleData ItemCount=5}"
                AllowDrop="True"
                Drop="ListBox_Drop"
                ItemsSource="{Binding FrontImages, IsAsync=True}"
                PreviewMouseMove="ListBox_PreviewMouseMove"
                SelectedItem="{Binding DataContext.CurrentFrontImageModel.Value, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
                SelectionChanged="ListBox_SelectionChanged">
                <ListBox.ItemsPanel>
                  <ItemsPanelTemplate>
                    <WrapPanel />
                  </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                  <DataTemplate>
                    <Grid DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}}" Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}">
                      <Grid.ContextMenu>
                        <ContextMenu>
                          <MenuItem
                            d:Header="修改图片"
                            Command="{Binding PlacementTarget.Tag.ChangeImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            Header="{ll:Str 修改图片}"
                            IsEnabled="{Binding PlacementTarget.Tag.PlayCommand.CurrentCanExecute.Value, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}" />
                          <MenuItem
                            d:Header="删除图片"
                            Command="{Binding PlacementTarget.Tag.RemoveImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            Header="{ll:Str 删除图片}"
                            IsEnabled="{Binding PlacementTarget.Tag.PlayCommand.CurrentCanExecute.Value, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}" />
                        </ContextMenu>
                      </Grid.ContextMenu>
                      <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                      </Grid.RowDefinitions>
                      <Image
                        Width="150"
                        Height="150"
                        d:DataContext=""
                        DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ListBoxItem, Mode=FindAncestor}}"
                        Source="{Binding Image.Value, IsAsync=True}">
                        <Image.ToolTip>
                          <Image
                            Width="250"
                            Height="250"
                            Source="{Binding Image.Value, IsAsync=True}" />
                        </Image.ToolTip>
                      </Image>
                      <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="Auto" />
                          <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label d:Content="持续时间(ms)" Content="{ll:Str 持续时间(ms)}" />
                        <pu:NumberInput Grid.Column="1" Value="{Binding DataContext.Duration.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem, Mode=FindAncestor}}" />
                      </Grid>
                    </Grid>
                  </DataTemplate>
                </ListBox.ItemTemplate>
              </ListBox>
            </GroupBox>
            <GroupBox Grid.Row="1">
              <GroupBox.Header>
                <StackPanel Orientation="Horizontal">
                  <Label d:Content="底层图片" Content="{ll:Str 底层图片}" />
                  <TextBlock Margin="10,0,0,0">
                    <TextBlock.Text>
                      <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})">
                        <Binding Path="BackImages.Count" />
                      </MultiBinding>
                    </TextBlock.Text>
                  </TextBlock>
                </StackPanel>
              </GroupBox.Header>
              <ListBox
                d:ItemsSource="{d:SampleData ItemCount=5}"
                AllowDrop="True"
                Drop="ListBox_Drop"
                ItemsSource="{Binding BackImages, IsAsync=True}"
                PreviewMouseMove="ListBox_PreviewMouseMove"
                SelectedItem="{Binding DataContext.CurrentBackImageModel.Value, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
                SelectionChanged="ListBox_SelectionChanged">
                <ListBox.ItemsPanel>
                  <ItemsPanelTemplate>
                    <WrapPanel />
                  </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                  <DataTemplate>
                    <Grid DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}}" Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}">
                      <Grid.ContextMenu>
                        <ContextMenu>
                          <MenuItem
                            d:Header="修改图片"
                            Command="{Binding PlacementTarget.Tag.ChangeImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            Header="{ll:Str 修改图片}"
                            IsEnabled="{Binding PlacementTarget.Tag.PlayCommand.CurrentCanExecute.Value, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}" />
                          <MenuItem
                            d:Header="删除图片"
                            Command="{Binding PlacementTarget.Tag.RemoveImageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType=ContextMenu, Mode=FindAncestor}}"
                            Header="{ll:Str 删除图片}" />
                        </ContextMenu>
                      </Grid.ContextMenu>
                      <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                      </Grid.RowDefinitions>
                      <Image
                        Width="150"
                        Height="150"
                        d:DataContext=""
                        DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ListBoxItem, Mode=FindAncestor}}"
                        Source="{Binding Image.Value, IsAsync=True}">
                        <Image.ToolTip>
                          <Image
                            Width="250"
                            Height="250"
                            Source="{Binding Image.Value, IsAsync=True}" />
                        </Image.ToolTip>
                      </Image>
                      <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="Auto" />
                          <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label d:Content="持续时间(ms)" Content="{ll:Str 持续时间(ms)}" />
                        <pu:NumberInput Grid.Column="1" Value="{Binding DataContext.Duration.Value, RelativeSource={RelativeSource AncestorType=ListBoxItem, Mode=FindAncestor}}" />
                      </Grid>
                    </Grid>
                  </DataTemplate>
                </ListBox.ItemTemplate>
              </ListBox>
            </GroupBox>
          </Grid>
          <GroupBox Grid.Column="1">
            <GroupBox.Header>
              <StackPanel Orientation="Horizontal">
                <Label d:Content="食物位置" Content="{ll:Str 食物位置}" />
                <TextBlock Margin="10,0,0,0">
                  <TextBlock.Text>
                    <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})">
                      <Binding Path="FrontImages.Count" />
                    </MultiBinding>
                  </TextBlock.Text>
                </TextBlock>
              </StackPanel>
            </GroupBox.Header>
            <ListBox
              d:ItemsSource="{d:SampleData ItemCount=5}"
              ItemsSource="{Binding FoodLocations, IsAsync=True}"
              SelectedItem="{Binding DataContext.CurrentFoodLocationModel.Value, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
              SelectionChanged="ListBox_SelectionChanged">
              <ListBox.ItemTemplate>
                <DataTemplate>
                  <Grid>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="Auto" />
                      <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Label d:Content="持续时间 (ms)" Content="{ll:Str 持续时间 (ms)}" />
                    <pu:NumberInput Grid.Column="1" Value="{Binding Duration.Value}" />
                    <Label
                      Grid.Row="1"
                      d:Content="旋转角度"
                      Content="{ll:Str 旋转角度}" />
                    <pu:NumberInput
                      Grid.Row="1"
                      Grid.Column="1"
                      Value="{Binding Rotate.Value}" />
                    <Label
                      Grid.Row="2"
                      d:Content="透明度"
                      Content="{ll:Str 透明度}" />
                    <pu:NumberInput
                      Grid.Row="2"
                      Grid.Column="1"
                      Value="{Binding Opacity.Value}" />
                    <Label
                      Grid.Row="3"
                      d:Content="长度"
                      Content="{ll:Str 长度}" />
                    <pu:NumberInput
                      Grid.Row="3"
                      Grid.Column="1"
                      Value="{Binding Rect.Width.Value}" />
                    <Grid Grid.Row="4" Grid.ColumnSpan="2">
                      <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                      </Grid.ColumnDefinitions>
                      <Grid>
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="Auto" />
                          <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label Content="X:" />
                        <pu:NumberInput Grid.Column="1" Value="{Binding Rect.X.Value}" />
                      </Grid>
                      <Grid Grid.Column="1">
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="Auto" />
                          <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label Content="Y:" />
                        <pu:NumberInput Grid.Column="1" Value="{Binding Rect.Y.Value}" />
                      </Grid>
                    </Grid>
                  </Grid>
                </DataTemplate>
              </ListBox.ItemTemplate>
            </ListBox>
          </GroupBox>
        </Grid>
      </Expander>
    </DataTemplate>
  </Window.Resources>
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition />
      </Grid.RowDefinitions>
      <Grid>
        <Grid.ContextMenu>
          <ContextMenu>
            <MenuItem Command="{Binding ReplaceFoodImageCommand}" Header="{ll:Str 替换测试食物图片}" />
            <MenuItem Command="{Binding ResetFoodImageCommand}" Header="{ll:Str 重置测试食物图片}">
              <MenuItem.IsEnabled>
                <MultiBinding Converter="{StaticResource NotEqualsConverter}">
                  <Binding Path="FoodImage.Value" />
                  <Binding Path="DefaultFoodImage" />
                </MultiBinding>
              </MenuItem.IsEnabled>
            </MenuItem>
          </ContextMenu>
        </Grid.ContextMenu>
        <Image
          x:Name="Image_Back"
          Width="250"
          Height="250"
          Source="{Binding CurrentBackImageModel.Value.Image.Value}" />
        <Image
          x:Name="Image_Food"
          Height="{Binding Width, RelativeSource={RelativeSource Mode=Self}}"
          HorizontalAlignment="Left"
          VerticalAlignment="Top"
          Opacity="{Binding CurrentFoodLocationModel.Value.Opacity.Value}"
          RenderTransformOrigin="0,0"
          Source="{Binding FoodImage.Value}">
          <Image.RenderTransform>
            <TransformGroup>
              <ScaleTransform />
              <SkewTransform />
              <RotateTransform Angle="{Binding CurrentFoodLocationModel.Value.Rotate.Value}" />
              <TranslateTransform />
            </TransformGroup>
          </Image.RenderTransform>
          <Image.Style>
            <Style TargetType="Image">
              <Setter Property="Width">
                <Setter.Value>
                  <MultiBinding Converter="{StaticResource CalculatorConverter}" ConverterParameter="*">
                    <Binding Path="CurrentFoodLocationModel.Value.Rect.Width.Value" />
                    <Binding Path="LengthRatio.Value" />
                  </MultiBinding>
                </Setter.Value>
              </Setter>
              <Setter Property="Margin">
                <Setter.Value>
                  <MultiBinding Converter="{StaticResource RatioMarginConverter}">
                    <Binding Path="LengthRatio.Value" />
                    <Binding Path="CurrentFoodLocationModel.Value.Rect.X.Value" />
                    <Binding Path="CurrentFoodLocationModel.Value.Rect.Y.Value" />
                  </MultiBinding>
                </Setter.Value>
              </Setter>
            </Style>
          </Image.Style>
        </Image>
        <Image
          x:Name="Image_Front"
          Width="250"
          Height="250"
          Source="{Binding CurrentFrontImageModel.Value.Image.Value}">
          <Image.ToolTip>
            <Grid>
              <Image
                Width="500"
                Height="500"
                Source="{Binding CurrentBackImageModel.Value.Image.Value}" />
              <Image
                Height="{Binding Width, RelativeSource={RelativeSource Mode=Self}}"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Opacity="{Binding CurrentFoodLocationModel.Value.Opacity.Value}"
                RenderTransformOrigin="0,0"
                Source="{Binding FoodImage.Value}">
                <Image.RenderTransform>
                  <TransformGroup>
                    <ScaleTransform />
                    <SkewTransform />
                    <RotateTransform Angle="{Binding CurrentFoodLocationModel.Value.Rotate.Value}" />
                    <TranslateTransform />
                  </TransformGroup>
                </Image.RenderTransform>
                <Image.Style>
                  <Style TargetType="Image">
                    <Setter Property="Width">
                      <Setter.Value>
                        <MultiBinding Converter="{StaticResource CalculatorConverter}" ConverterParameter="*">
                          <Binding Path="CurrentFoodLocationModel.Value.Rect.Width.Value" />
                          <Binding Source="1" />
                        </MultiBinding>
                      </Setter.Value>
                    </Setter>
                    <Setter Property="Margin">
                      <Setter.Value>
                        <MultiBinding Converter="{StaticResource RatioMarginConverter}">
                          <Binding Source="1" />
                          <Binding Path="CurrentFoodLocationModel.Value.Rect.X.Value" />
                          <Binding Path="CurrentFoodLocationModel.Value.Rect.Y.Value" />
                        </MultiBinding>
                      </Setter.Value>
                    </Setter>
                  </Style>
                </Image.Style>
              </Image>
              <Image
                Width="500"
                Height="500"
                Source="{Binding CurrentFrontImageModel.Value.Image.Value}" />
            </Grid>
          </Image.ToolTip>
        </Image>
      </Grid>
      <Grid Grid.Row="1">
        <Grid.ColumnDefinitions>
          <ColumnDefinition />
          <ColumnDefinition />
          <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Button Command="{Binding StopCommand}" Content="{ll:Str 停止}" />
        <Button
          Grid.Column="1"
          Command="{Binding PlayCommand}"
          Content="{ll:Str 播放}" />
        <ToggleButton
          Grid.Column="2"
          Content="{ll:Str 循环}"
          IsChecked="{Binding Loop.Value}" />
      </Grid>
      <Grid Grid.Row="2">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <!--<Label Content="{ll:Str 动画Id}" />
        <TextBox Grid.Column="1" />-->
        <Label Content="{ll:Str 动画类型}" />
        <TextBlock Grid.Column="1" Text="{Binding Anime.Value.GraphType}" />
        <Label
          Grid.Row="1"
          Content="{ll:Str 动画名称}"
          Visibility="{Binding HasAnimeName.Value, Converter={StaticResource FalseToHiddenConverter}}" />
        <TextBox
          Grid.Row="1"
          Grid.Column="1"
          pu:TextBoxHelper.Watermark="{ll:Str 动画名称}"
          Text="{Binding Anime.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}"
          Visibility="{Binding HasAnimeName.Value, Converter={StaticResource FalseToHiddenConverter}}" />
      </Grid>
    </Grid>
    <Grid Grid.Column="1">
      <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <TabControl SelectionChanged="TabControl_SelectionChanged">
        <TabItem d:Header="Happy (0)" Tag="Happy">
          <TabItem.Header>
            <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}{0} ({1})">
              <Binding Path="Tag" RelativeSource="{RelativeSource Mode=Self}" />
              <Binding Path="Anime.Value.HappyAnimes.Count" />
            </MultiBinding>
          </TabItem.Header>
          <ListBox
            x:Name="ListBox_Animes"
            d:ItemsSource="{d:SampleData ItemCount=5}"
            d:SelectedIndex="0"
            ItemContainerStyle="{StaticResource ListBoxItem_Style}"
            ItemTemplate="{StaticResource Expander_AnimeItem}"
            ItemsSource="{Binding Anime.Value.HappyAnimes, IsAsync=True}"
            SelectionChanged="ListBox_Animes_SelectionChanged" />
        </TabItem>
        <TabItem d:Header="Nomal (0)" Tag="Nomal">
          <TabItem.Header>
            <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}{0} ({1})">
              <Binding Path="Tag" RelativeSource="{RelativeSource Mode=Self}" />
              <Binding Path="Anime.Value.NomalAnimes.Count" />
            </MultiBinding>
          </TabItem.Header>
          <ListBox
            d:ItemsSource="{d:SampleData ItemCount=5}"
            d:SelectedIndex="0"
            ItemContainerStyle="{StaticResource ListBoxItem_Style}"
            ItemTemplate="{StaticResource Expander_AnimeItem}"
            ItemsSource="{Binding Anime.Value.NomalAnimes, IsAsync=True}" />
        </TabItem>
        <TabItem d:Header="PoorCondition (0)" Tag="PoorCondition">
          <TabItem.Header>
            <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}{0} ({1})">
              <Binding Path="Tag" RelativeSource="{RelativeSource Mode=Self}" />
              <Binding Path="Anime.Value.PoorConditionAnimes.Count" />
            </MultiBinding>
          </TabItem.Header>
          <ListBox
            d:ItemsSource="{d:SampleData ItemCount=5}"
            d:SelectedIndex="0"
            ItemContainerStyle="{StaticResource ListBoxItem_Style}"
            ItemTemplate="{StaticResource Expander_AnimeItem}"
            ItemsSource="{Binding Anime.Value.PoorConditionAnimes, IsAsync=True}" />
        </TabItem>
        <TabItem d:Header="Ill (0)" Tag="Ill">
          <TabItem.Header>
            <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}{0} ({1})">
              <Binding Path="Tag" RelativeSource="{RelativeSource Mode=Self}" />
              <Binding Path="Anime.Value.IllAnimes.Count" />
            </MultiBinding>
          </TabItem.Header>
          <ListBox
            d:ItemsSource="{d:SampleData ItemCount=5}"
            d:SelectedIndex="0"
            ItemContainerStyle="{StaticResource ListBoxItem_Style}"
            ItemTemplate="{StaticResource Expander_AnimeItem}"
            ItemsSource="{Binding Anime.Value.IllAnimes, IsAsync=True}" />
        </TabItem>
      </TabControl>
      <Grid Grid.Row="1">
        <Grid.ColumnDefinitions>
          <ColumnDefinition />
          <ColumnDefinition />
          <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Button
          x:Name="Button_AddAnime"
          Margin="10"
          Command="{Binding AddAnimeCommand}"
          Content="{ll:Str 添加动画}" />
        <Button
          x:Name="Button_Cancel"
          Grid.Column="1"
          Margin="10"
          Click="Button_Cancel_Click"
          Content="{ll:Str 取消}" />
        <Button
          x:Name="Button_Yes"
          Grid.Column="2"
          Margin="10"
          Click="Button_Yes_Click"
          Content="{ll:Str 确定}" />
      </Grid>
    </Grid>
  </Grid>
</Window>
