File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ namespace SourceGit.Views
12
12
public class HistoriesLayout : Grid
13
13
{
14
14
public static readonly StyledProperty < bool > UseHorizontalProperty =
15
- AvaloniaProperty . Register < HistoriesLayout , bool > ( nameof ( UseHorizontal ) ) ;
15
+ AvaloniaProperty . Register < HistoriesLayout , bool > ( nameof ( UseHorizontal ) , false ) ;
16
16
17
17
public bool UseHorizontal
18
18
{
@@ -22,19 +22,20 @@ public bool UseHorizontal
22
22
23
23
protected override Type StyleKeyOverride => typeof ( Grid ) ;
24
24
25
- public HistoriesLayout ( )
26
- {
27
- RefreshLayout ( ) ;
28
- }
29
-
30
25
protected override void OnPropertyChanged ( AvaloniaPropertyChangedEventArgs change )
31
26
{
32
27
base . OnPropertyChanged ( change ) ;
33
28
34
- if ( change . Property == UseHorizontalProperty )
29
+ if ( change . Property == UseHorizontalProperty && IsLoaded )
35
30
RefreshLayout ( ) ;
36
31
}
37
32
33
+ protected override void OnAttachedToVisualTree ( VisualTreeAttachmentEventArgs e )
34
+ {
35
+ base . OnAttachedToVisualTree ( e ) ;
36
+ RefreshLayout ( ) ;
37
+ }
38
+
38
39
private void RefreshLayout ( )
39
40
{
40
41
if ( UseHorizontal )
You can’t perform that action at this time.
0 commit comments