private void ChatHistoryTextChanged(object sender, TextChangedEventArgs e) { // If the chat box is already scrolled to the bottom, keep it at the bottom. // Otherwise, the user has scrolled up and we don't want to disturb them. if (ChatHistory.VerticalOffset + ChatHistory.ExtentHeight == ChatHistory.ViewportHeight) { ChatHistory.ScrollToEnd(); } }
//Function: private void Window_SizeChanged(object sender, SizeChangedEventArgs e) //Description: This function addops size of TextBox and messages displaying depend on of application size customized by user. // //Parameter: object sender // SizeChangedEventArgs e //Return Value: none private void Window_SizeChanged(object sender, SizeChangedEventArgs e) { ChatHistory.ScrollToEnd(); }
//Function: private void ChatHistory_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) //Description: This function scrolls messge space if nessesary to make all messages easy to read. // //Parameter: object sender // System.Windows.Controls.TextChangedEventArgs e //Return Value: none private void ChatHistory_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { ChatHistory.ScrollToEnd(); }