<Page
  x:Class="VPet.ModMaker.Views.ModEdit.FoodEdit.FoodPage"
  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.FoodEdit"
  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.FoodEdit"
  Title="FoodPage"
  d:DataContext="{d:DesignInstance Type=vm:FoodPageVM}"
  d:DesignHeight="450"
  d:DesignWidth="800"
  mc:Ignorable="d">
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition />
    </Grid.RowDefinitions>
    <TextBox
      pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}"
      Style="{DynamicResource StandardTextBoxStyle}"
      Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
    <DataGrid
      Grid.Row="1"
      d:ItemsSource="{d:SampleData ItemCount=5}"
      pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
      AutoGenerateColumns="False"
      CanUserAddRows="False"
      GridLinesVisibility="Horizontal"
      ItemsSource="{Binding ShowFoods.Value}"
      MouseDoubleClick="DataGrid_MouseDoubleClick"
      RowDetailsVisibilityMode="Visible"
      RowHeight="64"
      VirtualizingStackPanel.IsVirtualizing="True"
      VirtualizingStackPanel.VirtualizationMode="Recycling">
      <DataGrid.RowStyle>
        <Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="DataGridRow">
          <Setter Property="Height" Value="64" />
          <Setter Property="Tag" Value="{Binding}" />
          <Setter Property="ContextMenu" Value="{StaticResource ContextMenu_DataGridRow}" />
        </Style>
      </DataGrid.RowStyle>
      <DataGrid.Columns>
        <DataGridTextColumn
          Binding="{Binding Id.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="Id"
          IsReadOnly="True"
          SortMemberPath="Id.Value" />
        <DataGridTemplateColumn Header="{ll:Str 食物图片}" IsReadOnly="True">
          <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
              <Image
                Width="64"
                Height="64"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Source="{Binding Image.Value, IsAsync=True}"
                Stretch="Uniform">
                <Image.ToolTip>
                  <Image
                    Width="256"
                    Height="256"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Source="{Binding Image.Value, IsAsync=True}"
                    Stretch="Uniform" />
                </Image.ToolTip>
              </Image>
            </DataTemplate>
          </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
        <DataGridTextColumn
          Binding="{Binding CurrentI18nData.Value.Name.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 食物名称}"
          IsReadOnly="True"
          SortMemberPath="CurrentI18nData.Value.Name.Value" />
        <DataGridTextColumn
          Binding="{Binding Type.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 食物类型}"
          IsReadOnly="True"
          SortMemberPath="Type.Value" />
        <DataGridTextColumn
          Binding="{Binding Graph.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 指定动画}"
          IsReadOnly="True"
          SortMemberPath="Type.Value" />
        <DataGridTextColumn
          Binding="{Binding StrengthFood.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 饱腹值}"
          IsReadOnly="True"
          SortMemberPath="StrengthFood.Value" />
        <DataGridTextColumn
          Binding="{Binding StrengthDrink.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 口渴值}"
          IsReadOnly="True"
          SortMemberPath="StrengthDrink.Value" />
        <DataGridTextColumn
          Binding="{Binding Health.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 健康值}"
          IsReadOnly="True"
          SortMemberPath="Health.Value" />
        <DataGridTextColumn
          Binding="{Binding Strength.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 体力值}"
          IsReadOnly="True"
          SortMemberPath="Strength.Value" />
        <DataGridTextColumn
          Binding="{Binding Feeling.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 心情值}"
          IsReadOnly="True"
          SortMemberPath="Feeling.Value" />
        <DataGridTextColumn
          Binding="{Binding Likability.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 好感值}"
          IsReadOnly="True"
          SortMemberPath="Likability.Value" />
        <DataGridTextColumn
          Binding="{Binding Exp.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 经验值}"
          IsReadOnly="True"
          SortMemberPath="Exp.Value" />
        <DataGridTextColumn
          Binding="{Binding Price.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_LeftCenter}"
          Header="{ll:Str 价格}"
          IsReadOnly="True"
          SortMemberPath="Price.Value" />
        <DataGridTextColumn
          MaxWidth="300"
          Binding="{Binding CurrentI18nData.Value.Description.Value}"
          CanUserSort="True"
          ElementStyle="{DynamicResource TextBlock_Wrap}"
          Header="{ll:Str 描述}"
          IsReadOnly="True"
          SortMemberPath="CurrentI18nData.Value.Description.Value" />
      </DataGrid.Columns>
    </DataGrid>
    <Button
      Grid.Row="1"
      HorizontalAlignment="Right"
      VerticalAlignment="Bottom"
      Command="{Binding AddCommand}"
      Content="➕"
      Style="{StaticResource AddButton}" />
  </Grid>
</Page>
