lib/ui/MainForm.xaml
|
<Window 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:local="clr-x:Namespace:Fortigi" Title="Fortigi Omada Sql Troubleshooter" Background="{DynamicResource {x:Static SystemColors.ScrollBarBrushKey}}" x:Name="MainForm" BorderBrush="#FFC8C8C8" SizeToContent="Manual"> <Window.Style> <Style TargetType="Window"> <Setter Property="MinWidth" Value="1461" /> <Setter Property="Width" Value="1461" /> <Setter Property="MinHeight" Value="800" /> <Setter Property="Height" Value="800" /> </Style> </Window.Style> <Window.Resources> <!-- Close ("x") button inside each tab header (built in New-TabHeaderControl). Flat by default, Windows-style red highlight on hover. --> <Style x:Key="TabCloseButtonStyle" TargetType="Button"> <Setter Property="Width" Value="18" /> <Setter Property="Height" Value="18" /> <Setter Property="Padding" Value="0" /> <Setter Property="FontSize" Value="10" /> <Setter Property="Foreground" Value="#6B7280" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Cursor" Value="Hand" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border x:Name="CloseBorder" Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="True"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="CloseBorder" Property="Background" Value="#E81123" /> <Setter Property="Foreground" Value="White" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- Session tabs: square (no rounded corners), muted blue-grey when inactive, and the status-bar yellow (Khaki) when active. Implicit style so both the session tabs and the "+" add tab pick it up automatically. --> <Style TargetType="TabItem"> <Setter Property="Foreground" Value="#FF404040" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="TabItem"> <Border x:Name="TabBorder" Margin="0,0,2,0" Background="#FFD6DBE0" BorderBrush="#FF8A97A6" BorderThickness="1,1,1,0" CornerRadius="0" SnapsToDevicePixels="True"> <ContentPresenter x:Name="ContentSite" ContentSource="Header" Margin="10,3,8,4" VerticalAlignment="Center" HorizontalAlignment="Stretch" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter TargetName="TabBorder" Property="Background" Value="Khaki" /> <Setter Property="Panel.ZIndex" Value="1" /> <Setter Property="Foreground" Value="#FF1F1F1F" /> </Trigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsSelected" Value="False" /> <Condition Property="IsMouseOver" Value="True" /> </MultiTrigger.Conditions> <Setter TargetName="TabBorder" Property="Background" Value="#FFE4E8EC" /> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- Tab right-click context menu look, matching the DataGrid result context menu (rounded white card + drop shadow, flat menu rows with icon/header/gesture). New-TabContextMenu builds the ContextMenu in code and references these. --> <ControlTemplate x:Key="TabContextMenuTemplate" TargetType="ContextMenu"> <Border Background="White" BorderBrush="#D9D9D9" BorderThickness="1" CornerRadius="4" Margin="6" SnapsToDevicePixels="True"> <Border.Effect> <DropShadowEffect BlurRadius="12" ShadowDepth="2" Opacity="0.18" Color="Black" /> </Border.Effect> <ItemsPresenter Margin="0,4" /> </Border> </ControlTemplate> <ControlTemplate x:Key="TabFlatMenuItem" TargetType="MenuItem"> <Border x:Name="Border" Background="Transparent" Padding="12,8"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="18" /> <ColumnDefinition Width="12" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="16" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <ContentPresenter Grid.Column="0" ContentSource="Icon" VerticalAlignment="Center" HorizontalAlignment="Center" /> <ContentPresenter Grid.Column="2" ContentSource="Header" RecognizesAccessKey="True" VerticalAlignment="Center" /> <TextBlock Grid.Column="4" Text="{TemplateBinding InputGestureText}" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Opacity="0.75" /> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsHighlighted" Value="True"> <Setter TargetName="Border" Property="Background" Value="#F1F5F9" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value="0.5" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <ControlTemplate x:Key="TabMenuSeparatorTemplate" TargetType="Separator"> <Border Height="1" Margin="12,4" Background="#E5E7EB" /> </ControlTemplate> </Window.Resources> <Grid x:Name="MainWindowGrid"> <!-- The navy (#FF293955) frame wraps the entire TabControl (tabs included): the top border is the purple bar above the tabs and the left/right/bottom borders (all 6px, matching) frame the tabs and content together. This is the border moved out of MainFormTabContent's MainGrid. --> <Border BorderBrush="#FF293955" BorderThickness="6" Background="{DynamicResource {x:Static SystemColors.ScrollBarBrushKey}}"> <!-- SelectedIndex=-1 is required: with only TabItemAddNew present at load time, a TabControl otherwise auto-selects it as soon as the control materializes - well before MainForm.Definition's Add_Loaded/ Restore-TabSessions runs - which fires New-TabSession reentrantly against the still-loading MainForm. --> <TabControl x:Name="TabControlSessions" BorderThickness="0" Padding="0" Background="Transparent" SelectedIndex="-1"> <!-- Minimal template: just the tab strip and the selected content; the navy frame is the outer Border above. --> <TabControl.Template> <ControlTemplate TargetType="TabControl"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <!-- ItemsPresenter (not a hard-coded TabPanel) so the single-row ShrinkingTabPanel set as ItemsPanel in MainForm.Definition is used. --> <ItemsPresenter Grid.Row="0" Panel.ZIndex="1" /> <ContentPresenter Grid.Row="1" ContentSource="SelectedContent" /> </Grid> </ControlTemplate> </TabControl.Template> <TabItem x:Name="TabItemAddNew" Header="+" ToolTip="Open a new tab" /> </TabControl> </Border> </Grid> </Window> |