diff options
author | Rory& <root@rory.gay> | 2024-01-08 13:55:15 +0100 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-01-08 13:56:32 +0100 |
commit | ede3857084bc7c6e65b7d36cbf913b09596e2787 (patch) | |
tree | b94694c307fb831ea5e63fabde0dbb5f56f02941 /MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs | |
parent | Small changes (diff) | |
download | MatrixUtils-ede3857084bc7c6e65b7d36cbf913b09596e2787.tar.xz |
Internal changes to policy list viewer (extensibility), fix duplicating change handler for room list page (performance), use /state in room list page before sync
Diffstat (limited to 'MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs')
-rw-r--r-- | MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs b/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs index d6343e2..92c617b 100644 --- a/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs +++ b/MatrixRoomUtils.Desktop/Components/NavigationStack.axaml.cs @@ -1,4 +1,5 @@ using Avalonia.Controls; +using Avalonia.Interactivity; using Avalonia.Markup.Xaml; namespace MatrixRoomUtils.Desktop.Components; @@ -8,12 +9,24 @@ public partial class NavigationStack : UserControl { InitializeComponent(); } - private void InitializeComponent() { - AvaloniaXamlLoader.Load(this); + // private void InitializeComponent() { + // AvaloniaXamlLoader.Load(this); + // buildView(); + // } + + protected override void OnLoaded(RoutedEventArgs e) { + base.OnLoaded(e); buildView(); } - + private void buildView() { + if (navPanel is null) { + Console.WriteLine("NavigationStack buildView called while navpanel is null!"); + // await Task.Delay(100); + // if (navPanel is null) + // await buildView(); + // else Console.WriteLine("navpanel is not null!"); + } navPanel.Children.Clear(); foreach (var item in _stack) { Button btn = new() { @@ -25,7 +38,7 @@ public partial class NavigationStack : UserControl { }; navPanel.Children.Add(btn); } - content = Current?.View ?? new UserControl(); + content.Content = Current?.View ?? new UserControl(); } @@ -44,13 +57,16 @@ public partial class NavigationStack : UserControl { Name = name, View = view }); + buildView(); } public void Pop() { _stack.RemoveAt(_stack.Count - 1); + buildView(); } public void PopTo(int index) { _stack.RemoveRange(index, _stack.Count - index); + buildView(); } } |