diff --git a/src/Views/Converters/WindowStateToTitleBarHeight.cs b/src/Views/Converters/WindowStateToTitleBarHeight.cs new file mode 100644 index 00000000..71eb580b --- /dev/null +++ b/src/Views/Converters/WindowStateToTitleBarHeight.cs @@ -0,0 +1,22 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace SourceGit.Views.Converters { + + /// + /// 将当前窗口的状态转换为标题栏高度 + /// + public class WindowStateToTitleBarHeight : IValueConverter { + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { + WindowState state = (WindowState)value; + return state == WindowState.Normal ? 36 : 30; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/src/Views/Launcher.xaml b/src/Views/Launcher.xaml index 2065c0ac..f47212b9 100644 --- a/src/Views/Launcher.xaml +++ b/src/Views/Launcher.xaml @@ -8,6 +8,7 @@ xmlns:controls="clr-namespace:SourceGit.Views.Controls" xmlns:widgets="clr-namespace:SourceGit.Views.Widgets" xmlns:models="clr-namespace:SourceGit.Models" + xmlns:converters="clr-namespace:SourceGit.Views.Converters" mc:Ignorable="d" WindowStartupLocation="CenterScreen" MinWidth="1024" MinHeight="768" @@ -16,16 +17,20 @@ Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, Mode=TwoWay}" WindowState="{Binding Source={x:Static models:Preference.Instance}, Path=Window.State, Mode=TwoWay}" Closing="OnClosing"> + + + + - + - + @@ -36,8 +41,8 @@