Chat-style host
A desktop messenger is one persistent window, in-place tabs, a filterable inbox, and a thread on the Frame stack. Bind SectionHostView to the host ViewModel — do not write visibility flippers in code-behind. Auth and forms stay on FormViewModel / IAuthState / UseAuth.
builder.Services.UseAvaloniaMvvmExpress(o => o
.UseFrameNavigation((nav, _) => nav
.Map<LoginViewModel, LoginPage>("login")
.Map<ChatHostViewModel, ChatHostPage>("chats")
.Map<ChatThreadViewModel, ChatThreadPage>("thread"))
.UseDialogs()
.UseAuth<LoginViewModel>());
await Navigator.ResetAsync<ChatHostViewModel>();
await Navigator.NavigateToAsync<ChatThreadViewModel, ChatNavArgs>(new(id));public sealed class ChatHostViewModel : SectionHostViewModel
{
public ChatHostViewModel()
{
Inbox = Add("chats", new ChatInboxViewModel(seed));
Add("updates", new ChatInboxViewModel([]));
}
public ChatInboxViewModel Inbox { get; }
}
// Bind SectionHostView. DataContext is the host; Current is the visible child.