|
| 1 | +<UserControl x:Class="Cirilla.UserControls.GMDEditor" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:root="clr-namespace:Cirilla" |
| 7 | + xmlns:convert="clr-namespace:Cirilla.Converters" |
| 8 | + mc:Ignorable="d" |
| 9 | + d:DesignHeight="450" d:DesignWidth="800"> |
| 10 | + <UserControl.Resources> |
| 11 | + <convert:InverseBooleanConverter x:Key="InverseBooleanConverter"/> |
| 12 | + </UserControl.Resources> |
| 13 | + |
| 14 | + <TabControl> |
| 15 | + <TabItem Header="Header"> |
| 16 | + <DataGrid ItemsSource="{Binding HeaderMetadata}" ColumnWidth="*" AutoGenerateColumns="False" BorderThickness="0" CanUserAddRows="False"> |
| 17 | + <DataGrid.Columns> |
| 18 | + <DataGridTextColumn Header="Key" Binding="{Binding Key}" IsReadOnly="True"/> |
| 19 | + <DataGridTextColumn Header="Value" Binding="{Binding Value}" IsReadOnly="True"/> |
| 20 | + </DataGrid.Columns> |
| 21 | + </DataGrid> |
| 22 | + </TabItem> |
| 23 | + |
| 24 | + <TabItem Header="Entries"> |
| 25 | + <Grid> |
| 26 | + <Grid.RowDefinitions> |
| 27 | + <RowDefinition Height="Auto"/> |
| 28 | + <RowDefinition Height="*"/> |
| 29 | + </Grid.RowDefinitions> |
| 30 | + |
| 31 | + <Grid Grid.Row="0" Margin="5"> |
| 32 | + <Grid.ColumnDefinitions> |
| 33 | + <ColumnDefinition Width="Auto"/> |
| 34 | + <ColumnDefinition Width="*"/> |
| 35 | + </Grid.ColumnDefinitions> |
| 36 | + |
| 37 | + <TextBlock Grid.Column="0" Text="Search: "/> |
| 38 | + <TextBox Grid.Column="1" Text="{Binding SearchQuery, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}"> |
| 39 | + <TextBox.InputBindings> |
| 40 | + <KeyBinding Key="Return" Command="{Binding TriggerSearchCommand}"/> |
| 41 | + </TextBox.InputBindings> |
| 42 | + </TextBox> |
| 43 | + </Grid> |
| 44 | + |
| 45 | + <DataGrid Grid.Row="1" ItemsSource="{Binding FilteredEntries}" ColumnWidth="*" AutoGenerateColumns="False" BorderThickness="0" CanUserDeleteRows="{root:SettingBinding UnsafeModeEnabled}" CanUserAddRows="False"> |
| 46 | + <DataGrid.Columns> |
| 47 | + <DataGridTextColumn Header="Index" Binding="{Binding Index}" IsReadOnly="True" Width="50"/> |
| 48 | + <DataGridTextColumn Header="Key" Binding="{Binding Key}" IsReadOnly="{root:SettingBinding UnsafeModeEnabled, Converter={StaticResource InverseBooleanConverter}}"/> |
| 49 | + <DataGridTextColumn Header="Value" Binding="{Binding Value}"> |
| 50 | + <DataGridTextColumn.EditingElementStyle> |
| 51 | + <Style TargetType="TextBox"> |
| 52 | + <Setter Property="AcceptsReturn" Value="true" /> |
| 53 | + </Style> |
| 54 | + </DataGridTextColumn.EditingElementStyle> |
| 55 | + </DataGridTextColumn> |
| 56 | + </DataGrid.Columns> |
| 57 | + |
| 58 | + <DataGrid.RowStyle> |
| 59 | + <Style TargetType="DataGridRow"> |
| 60 | + <Style.Triggers> |
| 61 | + <DataTrigger Binding="{Binding Value}" Value="Invalid Message"> |
| 62 | + <Setter Property="Background" Value="Yellow"/> |
| 63 | + </DataTrigger> |
| 64 | + <DataTrigger Binding="{Binding Key}" Value=""> |
| 65 | + <Setter Property="Background" Value="Orange"/> |
| 66 | + </DataTrigger> |
| 67 | + </Style.Triggers> |
| 68 | + </Style> |
| 69 | + </DataGrid.RowStyle> |
| 70 | + |
| 71 | + <DataGrid.ContextMenu> |
| 72 | + <ContextMenu> |
| 73 | + <MenuItem Header="Add Normal entry (with key)" Command="{Binding AddEntryCommand}"/> |
| 74 | + <MenuItem Header="Add Padding entry (no key)" Command="{Binding AddEntryNoKeyCommand}"/> |
| 75 | + </ContextMenu> |
| 76 | + </DataGrid.ContextMenu> |
| 77 | + </DataGrid> |
| 78 | + </Grid> |
| 79 | + </TabItem> |
| 80 | + </TabControl> |
| 81 | +</UserControl> |
0 commit comments