private void LogoutItem_Click(object sender, RoutedEventArgs e) { controller.LogoutUser(); BitmapImage bitmap = new BitmapImage(new Uri("Resources\\redndot.png", UriKind.Relative)); OnlineImage.Source = bitmap; ChangeActiveButtons(false); menuItemLogin.Header = "Log in"; menuItemLogin.Click -= LogoutItem_Click; menuItemLogin.Click += new RoutedEventHandler(LoginItem_Click); richTextBox.Document = new FlowDocument(); }