2 Commits
Author SHA1 Message Date
ded_ikar 0c2212cde9 Add dark custom title bar with WindowChrome 2026-06-08 20:31:38 +05:00
Your Name 793076b948 initial 2026-06-06 00:37:49 +05:00
9 changed files with 235 additions and 20 deletions
BIN
View File
Binary file not shown.
+57
View File
@@ -83,6 +83,63 @@
<Setter Property="Foreground" Value="White"/> <Setter Property="Foreground" Value="White"/>
</Style> </Style>
<!-- Стиль для кастомного заголовка окна -->
<Style x:Key="TitleBar" TargetType="Border">
<Setter Property="Background" Value="#2D2D2D"/>
<Setter Property="Height" Value="30"/>
<Setter Property="BorderBrush" Value="#444444"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="CornerRadius" Value="8,8,0,0"/>
</Style>
<Style x:Key="TitleBarText" TargetType="TextBlock">
<Setter Property="Foreground" Value="#CCCCCC"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="12,0,0,0"/>
</Style>
<Style x:Key="TitleBarButton" TargetType="Button">
<Setter Property="Width" Value="46"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}">
<TextBlock Text="{TemplateBinding Content}"
FontFamily="Segoe MDL2 Assets"
FontSize="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#3C3C3C"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#2A2A2A"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarCloseButton" TargetType="Button" BasedOn="{StaticResource TitleBarButton}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E81123"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#F1707A"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- Стиль для MessageBox buttons --> <!-- Стиль для MessageBox buttons -->
<Style TargetType="Button" x:Key="{x:Type Button}"> <Style TargetType="Button" x:Key="{x:Type Button}">
<Setter Property="Background" Value="#3C3C3C"/> <Setter Property="Background" Value="#3C3C3C"/>
+29 -1
View File
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="QoS Manager" Title="QoS Manager"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
WindowStyle="None"
ResizeMode="NoResize" ResizeMode="NoResize"
SizeToContent="WidthAndHeight" SizeToContent="WidthAndHeight"
Background="#2D2D2D" Background="#2D2D2D"
@@ -12,7 +13,32 @@
MinWidth="300" MinWidth="300"
MaxWidth="500"> MaxWidth="500">
<Grid Margin="20"> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" GlassFrameThickness="0" ResizeBorderThickness="0" UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Border BorderBrush="#555555" BorderThickness="1" CornerRadius="8" Background="#2D2D2D">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Border Grid.Row="0" Style="{StaticResource TitleBar}"
MouseLeftButtonDown="TitleBar_MouseLeftButtonDown">
<Grid>
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=Title}"
Style="{StaticResource TitleBarText}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="CloseButton" Style="{StaticResource TitleBarCloseButton}"
Click="CloseButton_Click" Content="&#xE8BB;"/>
</StackPanel>
</Grid>
</Border>
<!-- Content -->
<Grid Grid.Row="1" Margin="20">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="20"/> <RowDefinition Height="20"/>
@@ -70,4 +96,6 @@
Visibility="Collapsed"/> Visibility="Collapsed"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid>
</Border>
</Window> </Window>
+33 -1
View File
@@ -5,9 +5,39 @@
Height="600" Width="900" Height="600" Width="900"
MinHeight="400" MinWidth="600" MinHeight="400" MinWidth="600"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
WindowStyle="None"
Background="#1E1E1E"> Background="#1E1E1E">
<Grid Margin="20"> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" GlassFrameThickness="0" ResizeBorderThickness="5" UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Border BorderBrush="#555555" BorderThickness="1" CornerRadius="8" Background="#1E1E1E">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Border Grid.Row="0" Style="{StaticResource TitleBar}"
MouseLeftButtonDown="TitleBar_MouseLeftButtonDown">
<Grid>
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=Title}"
Style="{StaticResource TitleBarText}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="MinimizeButton" Style="{StaticResource TitleBarButton}"
Click="MinimizeButton_Click" Content="&#xE921;"/>
<Button x:Name="MaximizeButton" Style="{StaticResource TitleBarButton}"
Click="MaximizeButton_Click" Content="&#xE922;"/>
<Button x:Name="CloseButton" Style="{StaticResource TitleBarCloseButton}"
Click="CloseButton_Click" Content="&#xE8BB;"/>
</StackPanel>
</Grid>
</Border>
<!-- Content -->
<Grid Grid.Row="1" Margin="20">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@@ -203,4 +233,6 @@
Style="{StaticResource DarkButtonStyle}"/> Style="{StaticResource DarkButtonStyle}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid>
</Border>
</Window> </Window>
+7
View File
@@ -336,6 +336,13 @@ namespace QoSManager.Views
Close(); Close();
} }
protected override void OnStateChanged(EventArgs e)
{
base.OnStateChanged(e);
if (MaximizeButton != null)
MaximizeButton.Content = WindowState == WindowState.Maximized ? "\uE923" : "\uE922";
}
protected override void OnClosed(EventArgs e) protected override void OnClosed(EventArgs e)
{ {
SaveSettings(); SaveSettings();
+29 -1
View File
@@ -4,10 +4,36 @@
Title="Создание QoS-политики" Title="Создание QoS-политики"
Height="320" Width="500" Height="320" Width="500"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
WindowStyle="None"
Background="#1E1E1E" Background="#1E1E1E"
ResizeMode="NoResize"> ResizeMode="NoResize">
<Grid Margin="20"> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" GlassFrameThickness="0" ResizeBorderThickness="0" UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Border BorderBrush="#555555" BorderThickness="1" CornerRadius="8" Background="#1E1E1E">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Border Grid.Row="0" Style="{StaticResource TitleBar}"
MouseLeftButtonDown="TitleBar_MouseLeftButtonDown">
<Grid>
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=Title}"
Style="{StaticResource TitleBarText}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="CloseButton" Style="{StaticResource TitleBarCloseButton}"
Click="CloseButton_Click" Content="&#xE8BB;"/>
</StackPanel>
</Grid>
</Border>
<!-- Content -->
<Grid Grid.Row="1" Margin="20">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
@@ -129,4 +155,6 @@
Style="{StaticResource DarkButtonStyle}"/> Style="{StaticResource DarkButtonStyle}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid>
</Border>
</Window> </Window>
+31 -1
View File
@@ -4,11 +4,39 @@
Title="Выбор процесса" Title="Выбор процесса"
Height="600" Width="800" Height="600" Width="800"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
WindowStyle="None"
ResizeMode="CanResize" ResizeMode="CanResize"
Background="#2b2b2b" Background="#2b2b2b"
TextElement.Foreground="White"> TextElement.Foreground="White">
<Grid Margin="10"> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" GlassFrameThickness="0" ResizeBorderThickness="5" UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Border BorderBrush="#555555" BorderThickness="1" CornerRadius="8" Background="#2b2b2b">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Border Grid.Row="0" Style="{StaticResource TitleBar}"
MouseLeftButtonDown="TitleBar_MouseLeftButtonDown">
<Grid>
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=Title}"
Style="{StaticResource TitleBarText}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="MinimizeButton" Style="{StaticResource TitleBarButton}"
Click="MinimizeButton_Click" Content="&#xE921;"/>
<Button x:Name="CloseButton" Style="{StaticResource TitleBarCloseButton}"
Click="CloseButton_Click" Content="&#xE8BB;"/>
</StackPanel>
</Grid>
</Border>
<!-- Content -->
<Grid Grid.Row="1" Margin="10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@@ -58,4 +86,6 @@
BorderBrush="#6a6a6a" Margin="0,0,10,0" Click="CancelButton_Click"/> BorderBrush="#6a6a6a" Margin="0,0,10,0" Click="CancelButton_Click"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid>
</Border>
</Window> </Window>
+5
View File
@@ -78,6 +78,11 @@ namespace QoSManager.Views
} }
} }
private void MinimizeButton_Click(object sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}
private void CloseButton_Click(object sender, RoutedEventArgs e) private void CloseButton_Click(object sender, RoutedEventArgs e)
{ {
DialogResult = false; DialogResult = false;
+29 -1
View File
@@ -3,10 +3,36 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Неподдерживаемая версия Windows" Height="520" Width="580" Title="Неподдерживаемая версия Windows" Height="520" Width="580"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
WindowStyle="None"
ResizeMode="NoResize" ResizeMode="NoResize"
Background="#2D2D30"> Background="#2D2D30">
<Grid Margin="25"> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" GlassFrameThickness="0" ResizeBorderThickness="0" UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Border BorderBrush="#555555" BorderThickness="1" CornerRadius="8" Background="#2D2D30">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title Bar -->
<Border Grid.Row="0" Style="{StaticResource TitleBar}"
MouseLeftButtonDown="TitleBar_MouseLeftButtonDown">
<Grid>
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=Title}"
Style="{StaticResource TitleBarText}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="CloseButton" Style="{StaticResource TitleBarCloseButton}"
Click="CloseButton_Click" Content="&#xE8BB;"/>
</StackPanel>
</Grid>
</Border>
<!-- Content -->
<Grid Grid.Row="1" Margin="25">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@@ -75,4 +101,6 @@
Click="ExitButton_Click"/> Click="ExitButton_Click"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid>
</Border>
</Window> </Window>