<Window x:Class="TMC_Tool.EditMatecpWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:TMC_Tool"
        xmlns:custom="clr-namespace:CustomControls"
        Title="EditMatecpWindow" SnapsToDevicePixels="True" Background="#FF333333" WindowStartupLocation="CenterOwner" AllowsTransparency="True" WindowStyle="None" Closing="Window_Closing" x:Name="editMatecpWindow" Activated="Window_Activated" Width="500" MinWidth="300" MinHeight="300" Height="450">
  <Window.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Themes/MetroDark/MetroDark.MSControls.Core.Implicit.xaml"/>
        <ResourceDictionary Source="Styles.xaml"/>
        <ResourceDictionary Source="Common/CustomControls.xaml"/>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Window.Resources>
  <WindowChrome.WindowChrome>
    <WindowChrome CaptionHeight="{x:Static SystemParameters.CaptionHeight}" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" UseAeroCaptionButtons="False"/>
  </WindowChrome.WindowChrome>
  <Border BorderThickness="1" BorderBrush="#FF666666" Margin="0,0,0,0">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="400*"/>
        <RowDefinition Height="45"/>
      </Grid.RowDefinitions>
      <TextBlock x:Name="title" Margin="7,8,7,0" Text="matecpを編集" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="14" Foreground="{DynamicResource DisabledForegroundBrush}"/>
      <Grid Margin="5,40,5,0">
        <Grid.RowDefinitions>
          <RowDefinition Height="190*"/>
          <RowDefinition Height="123*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="175"/>
          <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <DataGrid x:Name="dgCustomps" Margin="0,0,15,35" AutoGenerateColumns="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" GridLinesVisibility="Horizontal" ItemsSource="{Binding Customps}" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" HeadersVisibility="Column" HorizontalContentAlignment="Stretch" SelectionChanged="dgCustomps_SelectionChanged" Grid.RowSpan="2">
          <DataGrid.Resources>
            <ResourceDictionary>
              <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource DGColumnHeaderStyle}"/>
              <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource DGCellStyle}"/>
            </ResourceDictionary>
          </DataGrid.Resources>
          <DataGrid.Columns>
            <DataGridTextColumn x:Name="dgcIndex" Binding="{Binding Index}" Header="Index" IsReadOnly="True" Width="50"/>
            <DataGridTextColumn x:Name="dgcCount" Binding="{Binding Count}" Header="Count" IsReadOnly="True" Width="50"/>
            <DataGridTextColumn x:Name="dgcUse" Binding="{Binding Use}" Header="Use" IsReadOnly="True" Width="38"/>
            <DataGridTextColumn x:Name="dgcBlank" IsReadOnly="True" Width="*" MinWidth="0"/>
          </DataGrid.Columns>
        </DataGrid>
        <Button x:Name="btnAdd" Content="追加" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="50" Click="btnAdd_Click" Grid.Row="1" Height="30"/>
        <Button x:Name="btnGet" Content="取得" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="50" Click="btnGet_Click" Grid.Row="1" Height="30" Margin="55,0,0,0"/>
        <Button x:Name="btnDel" Content="削除" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="50" Click="btnDel_Click" Grid.Row="1" Height="30" Margin="110,0,0,0" IsEnabled="False"/>
        <Label x:Name="labelParams" Content="パラメータ" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1" Padding="0,0,0,3" Height="21" Width="60"/>
        <DataGrid x:Name="dgParams" Margin="0,21,0,45" Grid.Column="1" AutoGenerateColumns="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" GridLinesVisibility="Horizontal" ItemsSource="{Binding Params}" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" HeadersVisibility="Column" HorizontalContentAlignment="Stretch" SelectionChanged="dgParams_SelectionChanged">
          <DataGrid.Resources>
            <ResourceDictionary>
              <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource DGColumnHeaderStyle}"/>
              <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource DGCellStyle}"/>
            </ResourceDictionary>
          </DataGrid.Resources>
          <DataGrid.Columns>
            <DataGridTextColumn x:Name="dgcType" Binding="{Binding Type}" Header="Type" IsReadOnly="True" Width="150*" CellStyle="{StaticResource DGCellTextLeft}"/>
            <!--<DataGridTextColumn x:Name="dgcParam" Binding="{Binding Param}" Header="param" Width="50"/>-->
            <DataGridTextColumn x:Name="dgcParam" Binding="{Binding Param,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Header="Param" Width="60">
              <DataGridTextColumn.ElementStyle>
                <Style TargetType="{x:Type TextBlock}"/>
              </DataGridTextColumn.ElementStyle>
              <DataGridTextColumn.EditingElementStyle>
                <Style TargetType="{x:Type TextBox}">
                  <EventSetter Event="KeyDown" Handler="tbParam_KeyDown"/>
                  <Setter Property="VerticalContentAlignment" Value="Center"/>
                  <Setter Property="Height" Value="24"/>
                  <Setter Property="InputMethod.IsInputMethodSuspended" Value="True"/>
                </Style>
              </DataGridTextColumn.EditingElementStyle>
            </DataGridTextColumn>
          </DataGrid.Columns>
        </DataGrid>
        <ComboBox x:Name="cmbParam" Grid.Column="1" Margin="0,0,110,10" VerticalAlignment="Bottom" Height="30" FontFamily="Consolas" FontSize="14" SelectionChanged="cmbParam_SelectionChanged" IsEnabled="False"/>
        <Button x:Name="btnAddParam" Content="追加" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="50" Grid.Column="1" Margin="0,0,55,10" Click="btnAddParam_Click" Height="30" IsEnabled="False"/>
        <Button x:Name="btnDelParam" Content="削除" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="50" Grid.Column="1" Margin="0,0,0,10" Click="btnDelParam_Click" Height="30" IsEnabled="False"/>
        <Label x:Name="labelInfluenceObj" Content="影響を受けるオブジェクト" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1" Padding="0,0,0,3" Grid.Row="1" Height="21" Width="144"/>
        <TextBox x:Name="listInfluenceObj" Margin="0,21,0,0" IsReadOnly="True" VerticalScrollBarVisibility="Auto" IsTabStop="False" IsEnabled="False" Grid.Column="1" Grid.Row="1"/>
      </Grid>
      <StackPanel Margin="0" VerticalAlignment="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="1" Height="40" Width="189">
        <Button x:Name="btnOk" Content="OK" HorizontalAlignment="Right" VerticalAlignment="Top" Click="btnOk_Click" Margin="5" HorizontalContentAlignment="Center" MinWidth="87" IsEnabled="False"/>
        <Button x:Name="btnCancel" Content="キャンセル" VerticalAlignment="Top" Click="btnCancel_Click" Margin="0,5,5,5" IsCancel="True" IsDefault="True" MinWidth="87" HorizontalAlignment="Right"/>
      </StackPanel>
    </Grid>
  </Border>
</Window>
