<Page
  x:Class="VPet.ModMaker.Views.ModEdit.LowTextEdit.LowTextPage"
  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.LowTextEdit"
  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.LowTextEdit"
  Title="LowTextPage"
  d:DataContext="{d:DesignInstance Type=vm:LowTextPageVM}"
  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}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
    <DataGrid
      x:Name="DataGrid_LowText"
      Grid.Row="1"
      d:ItemsSource="{d:SampleData ItemCount=5}"
      pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
      AutoGenerateColumns="False"
      CanUserAddRows="False"
      GridLinesVisibility="Horizontal"
      ItemsSource="{Binding ShowLowTexts.Value}"
      MouseDoubleClick="DataGrid_LowText_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
          MaxWidth="200"
          Binding="{Binding Id.Value}"
          CanUserSort="True"
          ElementStyle="{StaticResource TextBlock_Wrap}"
          IsReadOnly="True"
          SortMemberPath="Id.Value">
          <DataGridTextColumn.Header>
            <TextBlock Text="Id" />
          </DataGridTextColumn.Header>
        </DataGridTextColumn>
        <DataGridTextColumn
          MaxWidth="300"
          Binding="{Binding CurrentI18nData.Value.Text.Value}"
          CanUserSort="True"
          ElementStyle="{StaticResource TextBlock_Wrap}"
          IsReadOnly="True"
          SortMemberPath="CurrentI18nData.Value.Text.Value">
          <DataGridTextColumn.Header>
            <TextBlock Text="{ll:Str 文本}" />
          </DataGridTextColumn.Header>
        </DataGridTextColumn>
        <DataGridTextColumn
          Binding="{Binding Mode.Value}"
          CanUserSort="True"
          IsReadOnly="True"
          SortMemberPath="Mode.Value">
          <DataGridTextColumn.Header>
            <TextBlock Text="{ll:Str 状态}" />
          </DataGridTextColumn.Header>
        </DataGridTextColumn>
        <DataGridTextColumn
          Binding="{Binding Strength.Value}"
          CanUserSort="True"
          IsReadOnly="True"
          SortMemberPath="Strength.Value">
          <DataGridTextColumn.Header>
            <TextBlock Text="{ll:Str 饥渴需求}" />
          </DataGridTextColumn.Header>
        </DataGridTextColumn>
        <DataGridTextColumn
          Binding="{Binding Like.Value}"
          CanUserSort="True"
          IsReadOnly="True"
          SortMemberPath="Like.Value">
          <DataGridTextColumn.Header>
            <TextBlock Text="{ll:Str 好感需求}" />
          </DataGridTextColumn.Header>
        </DataGridTextColumn>
      </DataGrid.Columns>
    </DataGrid>
    <Button
      Grid.Row="1"
      HorizontalAlignment="Right"
      VerticalAlignment="Bottom"
      Command="{Binding AddCommand}"
      Content="➕"
      Style="{StaticResource AddButton}" />
  </Grid>
</Page>
