private void Commdata_TextChanged(object sender, TextChangedEventArgs e) { if (auto_scroll_raw.IsChecked.Value) { Commdata.ScrollToEnd(); } }
private void WriteData(byte [] recieveData) { // write to disk InputDataCopy.Write(recieveData, 0, receivedbytes); Array.Copy(recieveData, 0, bufferForData, bufferForDataCount, receivedbytes); bufferForDataCount += receivedbytes; Show_block(); // Assign the value of the recieved_data to the RichTextBox. RAW para.Inlines.Clear(); para.Inlines.Add(sb.ToString()); mcFlowDoc.Blocks.Clear(); mcFlowDoc.Blocks.Add(para); Commdata.Document = mcFlowDoc; Commdata.ScrollToEnd(); // Assign the value of the recieved_data to the RichTextBox. DECODED para1.Inlines.Clear(); para1.Inlines.Add(sbdecoded.ToString()); mcFlowDoc1.Blocks.Clear(); mcFlowDoc1.Blocks.Add(para1); Parsedata.Document = mcFlowDoc1; Parsedata.ScrollToEnd(); // Get the current caret position. TextPointer caretPos = Parsedata.CaretPosition; // Set the TextPointer to the end of the current document. caretPos = caretPos.DocumentEnd; // Specify the new caret position at the end of the current document. Parsedata.CaretPosition = caretPos; Received_txt.Text = bufferForDataCount_backup.ToString(); }