private void OpenFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "All Files|*.*" + "|Text Files|*.txt;*.json;*.xml;*.xaml;*.js;*.cs;*.config"; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { FileStream fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read); StreamReader m_streamReader = new StreamReader(fs); m_streamReader.BaseStream.Seek(0, SeekOrigin.Begin); string strLine = m_streamReader.ReadLine(); while (strLine != null) { if (SendBox.Text.Trim().Length <= 0) { SendBox.Text += strLine; } else { SendBox.Text += "\n" + strLine; } strLine = m_streamReader.ReadLine(); } m_streamReader.Close(); } OpenFile.MoveFocus(new TraversalRequest(FocusNavigationDirection.Up)); }