-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
125 lines (123 loc) · 5.86 KB
/
MainWindow.xaml
File metadata and controls
125 lines (123 loc) · 5.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!--
MainWindow.xaml
Defines the main window layout, styles, and controls for the application.
- Custom styles for TabControl and TabItem.
- Three tabs with sample content.
- Popup for tab selection feedback.
-->
<Window x:Class="SSEC_Inventory.MainWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SSEC_Inventory"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<!-- Style for TabControl: removes background and border, adds padding -->
<Style TargetType="TabControl">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="10"/>
</Style>
<!-- Style for TabItem: customizes appearance and triggers for selection, hover, and disabled states -->
<Style TargetType="TabItem">
<Setter Property="Margin" Value="2,0,2,0"/>
<Setter Property="Padding" Value="16,8"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="#333"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border
x:Name="Border"
Background="{TemplateBinding Background}"
CornerRadius="10,10,0,0"
BorderThickness="1"
BorderBrush="#888"
Padding="{TemplateBinding Padding}">
<ContentPresenter
x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"/>
</Border>
<ControlTemplate.Triggers>
<!-- Selected tab appearance -->
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#FF6A00" Offset="0.0"/>
<GradientStop Color="#FFD800" Offset="1.0"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="White"/>
<Setter TargetName="Border" Property="BorderBrush" Value="#FF6A00"/>
</Trigger>
<!-- Mouse over tab appearance -->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#FFD800" Offset="0.0"/>
<GradientStop Color="#FF6A00" Offset="1.0"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="#FF6A00"/>
</Trigger>
<!-- Disabled tab appearance -->
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#AAA"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- Default background for tabs -->
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#FFF" Offset="0.0"/>
<GradientStop Color="#EEE" Offset="1.0"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="9*"/>
<ColumnDefinition Width="27*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<!-- TabControl with three tabs, handles selection change event -->
<TabControl Grid.ColumnSpan="3" SelectionChanged="TabControl_SelectionChanged">
<TabItem Header="Tab 1" AutomationProperties.Name="Tab 1">
<TextBlock Text="Content for Tab 1" Margin="10"/>
</TabItem>
<TabItem Header="Tab 2" AutomationProperties.Name="Tab 2">
<TextBlock Text="Content for Tab 2" Margin="10"/>
</TabItem>
<TabItem Header="Tab 3" AutomationProperties.Name="Tab 3">
<TextBlock Text="Content for Tab 3" Margin="10" Background="{DynamicResource {x:Static SystemColors.AccentColorBrushKey}}"/>
</TabItem>
</TabControl>
<!-- Popup to display selected tab information -->
<Popup x:Name="TabPopup"
Placement="Center"
StaysOpen="False"
AllowsTransparency="True"
PopupAnimation="Fade">
<Border Background="#FF6A00" CornerRadius="8" Padding="16" BorderBrush="#FFD800" BorderThickness="2" >
<TextBlock x:Name="TabPopupText"
Foreground="White"
FontWeight="Bold"
FontSize="16"
Text=""/>
</Border>
</Popup>
</Grid>
</Window>