mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
fix: MinWidth not work while manually resizing window (#619)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
ee20eba047
commit
5c92fbdb37
4 changed files with 30 additions and 2 deletions
|
@ -9,7 +9,7 @@
|
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SourceGit.Views.StashesPage"
|
||||
x:DataType="vm:StashesPage">
|
||||
<Grid>
|
||||
<Grid SizeChanged="OnMainLayoutSizeChanged">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.StashesLeftWidth, Mode=TwoWay}" MinWidth="300"/>
|
||||
<ColumnDefinition Width="4"/>
|
||||
|
|
|
@ -9,6 +9,20 @@ namespace SourceGit.Views
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnMainLayoutSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
var grid = sender as Grid;
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var layout = ViewModels.Preference.Instance.Layout;
|
||||
var width = grid.Bounds.Width;
|
||||
var maxLeft = width - 304;
|
||||
|
||||
if (layout.StashesLeftWidth.Value - maxLeft > 1.0)
|
||||
layout.StashesLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel);
|
||||
}
|
||||
|
||||
private void OnStashContextRequested(object sender, ContextRequestedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.StashesPage vm && sender is Border border)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
|
||||
x:Class="SourceGit.Views.WorkingCopy"
|
||||
x:DataType="vm:WorkingCopy">
|
||||
<Grid>
|
||||
<Grid SizeChanged="OnMainLayoutSizeChanged">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.WorkingCopyLeftWidth, Mode=TwoWay}" MinWidth="300"/>
|
||||
<ColumnDefinition Width="5"/>
|
||||
|
|
|
@ -11,6 +11,20 @@ namespace SourceGit.Views
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnMainLayoutSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
var grid = sender as Grid;
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var layout = ViewModels.Preference.Instance.Layout;
|
||||
var width = grid.Bounds.Width;
|
||||
var maxLeft = width - 304;
|
||||
|
||||
if (layout.WorkingCopyLeftWidth.Value - maxLeft > 1.0)
|
||||
layout.WorkingCopyLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel);
|
||||
}
|
||||
|
||||
private void OnOpenCommitMessagePicker(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button button && DataContext is ViewModels.WorkingCopy vm)
|
||||
|
|
Loading…
Reference in a new issue