diff --git a/src/TeamsISO.App/MainWindow.xaml b/src/TeamsISO.App/MainWindow.xaml index 4c3c4d6..ac39323 100644 --- a/src/TeamsISO.App/MainWindow.xaml +++ b/src/TeamsISO.App/MainWindow.xaml @@ -3,14 +3,33 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:TeamsISO.App.ViewModels" xmlns:conv="clr-namespace:TeamsISO.App.Converters" + xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework" Title="TeamsISO" Height="780" Width="1280" MinHeight="640" MinWidth="1080" Background="{DynamicResource Wd.Canvas}" + WindowStyle="None" + ResizeMode="CanResize" UseLayoutRounding="True" TextOptions.TextFormattingMode="Ideal" TextOptions.TextRenderingMode="ClearType"> + + + + + @@ -168,21 +187,66 @@ - - - - - - + + + + + + + + + + + + + diff --git a/src/TeamsISO.App/MainWindow.xaml.cs b/src/TeamsISO.App/MainWindow.xaml.cs index 34664bb..d73edea 100644 --- a/src/TeamsISO.App/MainWindow.xaml.cs +++ b/src/TeamsISO.App/MainWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Windows; +using System.Windows.Shapes; using TeamsISO.App.ViewModels; namespace TeamsISO.App; @@ -8,10 +9,37 @@ public partial class MainWindow : Window public MainWindow() { InitializeComponent(); + StateChanged += OnWindowStateChanged; } public MainWindow(MainViewModel viewModel) : this() { DataContext = viewModel; } + + /// Custom min button — chrome'd window has no system caption buttons. + private void OnMinimize(object sender, RoutedEventArgs e) => + WindowState = WindowState.Minimized; + + /// Toggles maximize/restore. Bound to the maximize button + double-click on the drag region. + private void OnMaximizeRestore(object sender, RoutedEventArgs e) => + WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; + + /// Custom close button. + private void OnClose(object sender, RoutedEventArgs e) => Close(); + + /// + /// Swap the maximize-button glyph between the "single rectangle" (when normal) and the + /// "two-overlapping-rectangles" (when maximized) variants, matching the Windows 11 + /// caption-button conventions. + /// + private void OnWindowStateChanged(object? sender, EventArgs e) + { + if (FindName("MaximizeIcon") is not Path icon) return; + icon.Data = WindowState == WindowState.Maximized + // Two-rectangle "restore" glyph + ? System.Windows.Media.Geometry.Parse("M 2,0 L 10,0 L 10,8 M 0,2 L 8,2 L 8,10 L 0,10 Z") + // Single-rectangle "maximize" glyph + : System.Windows.Media.Geometry.Parse("M 0,0 L 10,0 L 10,10 L 0,10 Z"); + } } diff --git a/src/TeamsISO.App/Themes/WildDragonTheme.xaml b/src/TeamsISO.App/Themes/WildDragonTheme.xaml index b3af5f5..d29ef83 100644 --- a/src/TeamsISO.App/Themes/WildDragonTheme.xaml +++ b/src/TeamsISO.App/Themes/WildDragonTheme.xaml @@ -186,6 +186,58 @@ + + + + +