1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-22 13:50:14 +00:00
msfs-popout-panel-manager/WpfApp/UserControlPanelConfiguration.xaml

235 lines
19 KiB
Text
Raw Normal View History

2022-01-27 13:40:04 +00:00
<UserControl x:Class="MSFSPopoutPanelManager.WpfApp.UserControlPanelConfiguration"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MSFSPopoutPanelManager.WpfApp"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
mc:Ignorable="d"
Height="505"
Width="920"
Background="#FF323A64">
<UserControl.Resources>
<ResourceDictionary>
<Style x:Key="TextBoxColumnFocus" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Style.Triggers>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="#FF576573" />
</Trigger>
2022-02-07 03:05:05 +00:00
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
<TextBlock Text="{TemplateBinding Text}" Padding="4" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
2022-01-27 13:40:04 +00:00
</Style.Triggers>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<UserControl.InputBindings>
<KeyBinding Command="{Binding Path=MinusTenPixelCommand}" CommandParameter="-10" Modifiers="Ctrl" Key="OemMinus"/>
<KeyBinding Command="{Binding Path=MinusOnePixelCommand}" CommandParameter="-1" Modifiers="Ctrl" Key="OemOpenBrackets" />
<KeyBinding Command="{Binding Path=PlusOnePixelCommand}" CommandParameter="1" Modifiers="Ctrl" Key="OemCloseBrackets" />
<KeyBinding Command="{Binding Path=PlusTenPixelCommand}" CommandParameter="10" Modifiers="Ctrl" Key="OemPlus" />
</UserControl.InputBindings>
<Grid>
<DockPanel>
<WrapPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="20,10,0,0" HorizontalAlignment="Left">
<Label Content="Panel Locations and Settings -" Margin="0,0,0,0" HorizontalAlignment="Left"/>
<Label Content="{Binding Path=DataStore.ActiveUserProfile.ProfileName}" Margin="0,0,0,0" HorizontalAlignment="Left"/>
<DataGrid Name="PanelConfigGrid" HorizontalAlignment="Center" Width="880" Height="390" Margin="0 10 0 0" AutoGenerateColumns="False" CanUserResizeColumns="False" HorizontalScrollBarVisibility="Disabled"
CanUserReorderColumns="False" CanUserResizeRows="False" HorizontalGridLinesBrush="#B9B9B9" VerticalGridLinesBrush="#B9B9B9" GridLinesVisibility="Horizontal" SelectionUnit="Cell"
BorderThickness="1" CanUserAddRows="False" CanUserSortColumns="False" KeyboardNavigation.TabNavigation="None" KeyboardNavigation.IsTabStop="False"
ItemsSource="{Binding Path=DataStore.ActiveUserProfile.PanelConfigs}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{x:Null}" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Text="{Binding}"></TextBlock>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="controls:ControlsHelper.ContentCharacterCasing" Value="Normal"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Background" Value="#FF576573"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#FFB9B9B9"/>
<Setter Property="Padding" Value="5,0,5,0"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="DataGridCell_PreviewMouseLeftButtonDown"/>
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="Panel Name" Width="230" >
2022-01-27 13:40:04 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<TextBox Name="PanelName" Width="230" BorderThickness="0" TextAlignment="Left" Text="{Binding Path=PanelName, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
2022-01-27 13:40:04 +00:00
SourceUpdated="GridData_SourceUpdated" IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}" IsEnabled="{Binding Path=IsCustomPopout, Mode=OneWay}">
<TextBox.Style>
<Style TargetType="TextBox">
<Setter Property="Focusable" Value="True"/>
<Setter Property="FontSize" Value="16" />
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Margin" Value="5, 5, 5, 5"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsCustomPopout}" Value="False">
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="Background" Value="#FF252525" />
<Setter Property="BorderBrush" Value="#FF252525" />
<Setter Property="IsReadOnly" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="X-Pos" Width="80">
2022-01-27 13:40:04 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<TextBox Name="Left" Width="80" BorderThickness="0"
2022-04-18 19:52:39 +00:00
Text="{Binding Path=Left, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/> </DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="Y-Pos" Width="80">
2022-04-18 19:52:39 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<TextBox Name="Top" Width="80" BorderThickness="0"
2022-04-18 19:52:39 +00:00
Text="{Binding Path=Top, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
2022-01-27 13:40:04 +00:00
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="Width" Width="80">
2022-01-27 13:40:04 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<TextBox Name="Width" Width="80" BorderThickness="0"
2022-04-18 19:52:39 +00:00
Text="{Binding Path=Width, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
2022-01-27 13:40:04 +00:00
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="Height" Width="80">
2022-01-27 13:40:04 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<TextBox Name="Height" Width="80" BorderThickness="0"
2022-04-18 19:52:39 +00:00
Text="{Binding Path=Height, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus}"
SourceUpdated="GridData_SourceUpdated"
Style="{StaticResource TextBoxColumnFocus}"
IsReadOnly="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='DataContext.DataStore.ActiveUserProfile.IsLocked or !DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
2022-01-27 13:40:04 +00:00
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="Always on Top" Width="80">
2022-01-27 13:40:04 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<CheckBox Name="AlwaysOnTop" Width="80" Margin="30 0 0 0"
2022-04-18 19:52:39 +00:00
SourceUpdated="GridData_SourceUpdated"
IsChecked="{Binding Path=AlwaysOnTop, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
2022-01-27 13:40:04 +00:00
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="Hide Title Bar" Width="80">
2022-01-27 13:40:04 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<CheckBox Name="HideTitlebar" Width="80" Margin="30 0 0 0"
2022-04-18 19:52:39 +00:00
SourceUpdated="GridData_SourceUpdated"
IsChecked="{Binding Path=HideTitlebar, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"
IsHitTestVisible="{c:Binding Path='!FullScreen'}"/>
2022-01-27 13:40:04 +00:00
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-04-18 19:52:39 +00:00
<DataGridTemplateColumn Header="Full Screen Mode" Width="90">
2022-01-27 13:40:04 +00:00
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
2022-06-13 03:49:56 +00:00
<CheckBox Name="FullScreen" Width="90" Margin="35 0 0 0"
2022-04-18 19:52:39 +00:00
SourceUpdated="GridData_SourceUpdated"
IsChecked="{Binding Path=FullScreen, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"/>
2022-01-27 13:40:04 +00:00
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-06-13 03:49:56 +00:00
<DataGridTemplateColumn Header="Touch Enabled" Width="80">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Name="TouchEnabled" Width="80" Margin="30 0 0 0"
SourceUpdated="GridData_SourceUpdated"
IsChecked="{Binding Path=TouchEnabled, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{c:Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid, AncestorLevel=1}, Path='!DataContext.DataStore.ActiveUserProfile.IsLocked and DataContext.DataStore.AllowEdit'}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
2022-01-27 13:40:04 +00:00
</DataGrid.Columns>
</DataGrid>
</WrapPanel>
<WrapPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="20,10,0,0" HorizontalAlignment="Left">
<Button Content="-10 px" ToolTip="Ctrl -" HorizontalAlignment="Center" Margin="0,0,0,0" Width="75" Command="{Binding Path=MinusTenPixelCommand}" CommandParameter="-10" IsEnabled="{c:Binding Path='!DataStore.ActiveUserProfile.IsLocked and DataStore.AllowEdit'}"/>
<Button Content="-1 px" ToolTip="Ctrl [" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding Path=MinusOnePixelCommand}" CommandParameter="-1" IsEnabled="{c:Binding Path='!DataStore.ActiveUserProfile.IsLocked and DataStore.AllowEdit'}"/>
<Button Content="+1 px" ToolTip="Ctrl ]" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding Path=PlusOnePixelCommand}" CommandParameter="1" IsEnabled="{c:Binding Path='!DataStore.ActiveUserProfile.IsLocked and DataStore.AllowEdit'}"/>
<Button Content="+10 px" ToolTip="Ctrl +" HorizontalAlignment="Center" Margin="20,0,0,0" Width="75" Command="{Binding Path=PlusTenPixelCommand}" CommandParameter="10" IsEnabled="{c:Binding Path='!DataStore.ActiveUserProfile.IsLocked and DataStore.AllowEdit'}"/>
<Button HorizontalAlignment="Center" Margin="390,0,0,0" Width="130" Click="LockPanels_Click" IsEnabled="{c:Binding Path='DataStore.AllowEdit'}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Content" Value="Lock Panels"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataStore.ActiveUserProfile.IsLocked, Mode=OneWay}" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Content" Value="Unlock Panels"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</WrapPanel>
</DockPanel>
</Grid>
</UserControl>