1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-22 22:00:11 +00:00
msfs-popout-panel-manager/MainApp/AppUserControl/PopOutPanelSourceCard.xaml

139 lines
7.1 KiB
Text
Raw Normal View History

2024-02-28 02:44:21 +00:00
<UserControl
x:Class="MSFSPopoutPanelManager.MainApp.AppUserControl.PopOutPanelSourceCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:converter="clr-namespace:MSFSPopoutPanelManager.MainApp.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:popOutPanelCard="clr-namespace:MSFSPopoutPanelManager.MainApp.AppUserControl.PopOutPanelCard"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:viewModel="clr-namespace:MSFSPopoutPanelManager.MainApp.ViewModel"
Width="860"
MinHeight="54"
mc:Ignorable="d">
<UserControl.Resources>
<converter:StringEmptyConverter x:Key="StringEmptyConverter" />
<system:Double x:Key="IconSize">22</system:Double>
<Style BasedOn="{StaticResource MaterialDesignIconForegroundButton}" TargetType="Button" />
<Style
x:Key="PopOutPanelExpander"
BasedOn="{StaticResource CustomMaterialDesignExpander}"
TargetType="Expander">
<Style.Triggers>
<DataTrigger Binding="{Binding DataItem.IsSelectedPanelSource}" Value="True">
<d:DataTrigger.DataContext>
<x:Type Type="viewModel:PopOutPanelSourceCardViewModel" />
</d:DataTrigger.DataContext>
<Setter Property="Background" Value="#525252" />
<Setter Property="Opacity" Value="0.9" />
</DataTrigger>
<DataTrigger Binding="{Binding DataItem.IsEditingPanel}" Value="True">
<d:DataTrigger.DataContext>
<x:Type Type="viewModel:PopOutPanelSourceCardViewModel" />
</d:DataTrigger.DataContext>
<Setter Property="Background" Value="#525252" />
<Setter Property="Opacity" Value="0.9" />
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<DockPanel d:DataContext="{d:DesignInstance viewModel:PopOutPanelSourceCardViewModel}">
<Expander
x:Name="RootExpander"
Width="860"
materialDesign:ExpanderAssist.HorizontalHeaderPadding="10,0,10,0"
BorderThickness="1"
PreviewMouseLeftButtonUp="RootExpander_OnPreviewMouseLeftButtonUp"
Style="{StaticResource PopOutPanelExpander}">
<Expander.Header>
<StackPanel Width="805" Orientation="Horizontal">
<StackPanel Width="24" Height="52" />
<!-- Panel name text box -->
<TextBox
x:Name="TxtBoxPanelName"
Width="260"
Margin="8,0,0,0"
Padding="0"
VerticalAlignment="Center"
HorizontalContentAlignment="Left"
materialDesign:HintAssist.FloatingScale="1"
materialDesign:HintAssist.Hint="Panel Name"
GotFocus="TextBox_GotFocus"
IsEnabled="{c:Binding 'DataItem.IsCustomPopOut'}"
KeyDown="TextBox_KeyDown"
SourceUpdated="Data_SourceUpdated"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding DataItem.PanelName, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
<TextBox
Width="85"
Margin="20,0,0,0"
Padding="0"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
materialDesign:HintAssist.FloatingScale="1"
materialDesign:HintAssist.Hint="Panel Src Left"
BorderBrush="Transparent"
IsHitTestVisible="False"
IsReadOnly="True"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding DataItem.PanelSource.X, Converter={StaticResource StringEmptyConverter}, ConverterParameter='N/A'}"
Visibility="{c:Binding 'DataItem.IsCustomPopOut'}" />
<TextBox
Width="85"
Margin="10,0,0,0"
Padding="0"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
materialDesign:HintAssist.FloatingScale="1"
materialDesign:HintAssist.Hint="Panel Src Top"
BorderBrush="Transparent"
IsHitTestVisible="False"
IsReadOnly="True"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding DataItem.PanelSource.Y, Converter={StaticResource StringEmptyConverter}, ConverterParameter='N/A'}"
Visibility="{c:Binding 'DataItem.IsCustomPopOut'}" />
<StackPanel
Width="220"
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{c:Binding 'DataItem.IsCustomPopOut'}">
<popOutPanelCard:PanelTargetField />
</StackPanel>
<!-- New panel -->
<Button
x:Name="BtnIdentifySourcePanel"
Width="80"
Margin="2,0,0,0"
VerticalAlignment="Center"
Command="{Binding AddPanelSourceLocationCommand}"
Content="Identify"
Foreground="White"
KeyboardNavigation.AcceptsReturn="False"
Style="{StaticResource MaterialDesignOutlinedButton}"
ToolTip="Identify source aircraft instrumentation panel location"
Visibility="{c:Binding 'DataItem.IsCustomPopOut and DataItem.PanelSource.X == null'}" />
<!-- Existing Panel -->
<materialDesign:PackIcon
x:Name="BtnShowSourcePanel"
Width="{StaticResource IconSize}"
Height="{StaticResource IconSize}"
Margin="31,0,0,0"
VerticalAlignment="Center"
Foreground="{Binding DataItem.PanelSource.Color}"
Kind="Crosshairs"
Visibility="{c:Binding 'DataItem.IsDeletablePanel and DataItem.PanelSource.X != null'}" />
</StackPanel>
</Expander.Header>
</Expander>
</DockPanel>
</UserControl>