private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { _viewmodel = e.NewValue as ChatViewVm; if (_viewmodel != null) { _viewmodel.OnMessagesChanged += OnMessagesChanged; } }
public MainWindowVm() { _chatService = new ChatService(); _chatService.ConnectedChanged += OnConnectedChanged; _chatView = new ChatViewVm(_chatService); _loginView = new LoginViewVm(_chatService); CurrentView = _loginView; }