Use the Loaded event in view init

This commit is contained in:
tyrrrz
2026-04-03 11:37:44 +03:00
parent ed33d19bc0
commit f1673cde77

View File

@@ -29,15 +29,7 @@ public partial class ViewManager
return null; return null;
view.DataContext ??= viewModel; view.DataContext ??= viewModel;
view.Loaded += async (_, _) => await viewModel.InitializeAsync();
if (view.IsInitialized)
{
_ = viewModel.InitializeAsync();
}
else
{
view.Initialized += async (_, _) => await viewModel.InitializeAsync();
}
return view; return view;
} }