fix: MinWidth not work while manually resizing window (#619)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-10-29 19:59:22 +08:00
parent ee20eba047
commit 5c92fbdb37
No known key found for this signature in database
4 changed files with 30 additions and 2 deletions

View file

@ -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)