mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 21:54:59 +00:00
fix: layout horizontal not working since 2025.9 after switching away from history screen (#1108)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
822452a20c
commit
ae1e46b586
1 changed files with 8 additions and 7 deletions
|
@ -12,7 +12,7 @@ namespace SourceGit.Views
|
||||||
public class HistoriesLayout : Grid
|
public class HistoriesLayout : Grid
|
||||||
{
|
{
|
||||||
public static readonly StyledProperty<bool> UseHorizontalProperty =
|
public static readonly StyledProperty<bool> UseHorizontalProperty =
|
||||||
AvaloniaProperty.Register<HistoriesLayout, bool>(nameof(UseHorizontal));
|
AvaloniaProperty.Register<HistoriesLayout, bool>(nameof(UseHorizontal), false);
|
||||||
|
|
||||||
public bool UseHorizontal
|
public bool UseHorizontal
|
||||||
{
|
{
|
||||||
|
@ -22,19 +22,20 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
protected override Type StyleKeyOverride => typeof(Grid);
|
protected override Type StyleKeyOverride => typeof(Grid);
|
||||||
|
|
||||||
public HistoriesLayout()
|
|
||||||
{
|
|
||||||
RefreshLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||||
{
|
{
|
||||||
base.OnPropertyChanged(change);
|
base.OnPropertyChanged(change);
|
||||||
|
|
||||||
if (change.Property == UseHorizontalProperty)
|
if (change.Property == UseHorizontalProperty && IsLoaded)
|
||||||
RefreshLayout();
|
RefreshLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnAttachedToVisualTree(e);
|
||||||
|
RefreshLayout();
|
||||||
|
}
|
||||||
|
|
||||||
private void RefreshLayout()
|
private void RefreshLayout()
|
||||||
{
|
{
|
||||||
if (UseHorizontal)
|
if (UseHorizontal)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue