locked
how To select particular text in Rich Edit Box RRS feed

  • Question

  • how To select particular text in Rich Edit Box 
    Thanks & Regards, With Raghav
    Thursday, December 15, 2011 11:42 AM

Answers

  • Hi Raghav,
    U can use the following to select the particular text:

    RichTextBox.Selection Propety

    • Proposed as answer by Barot Bhavik Friday, December 16, 2011 4:05 AM
    • Marked as answer by Sheldon _Xiao Tuesday, December 27, 2011 6:22 AM
    Thursday, December 15, 2011 2:08 PM
  • Hi Raghav,

     

    Again a property of RichTextBox should do that:

    RichTextBox.SelectionBrush

    You can also go through the following links for more info:

    http://forums.whirlpool.net.au/archive/719811

    http://stackoverflow.com/questions/5442067/change-color-and-font-for-some-part-of-text-in-wpf-c-sharp

     

    Hope i've answered your previous query as well, if so, please mark it as answer.

     

    Cheers,

    Chris

    • Proposed as answer by Barot Bhavik Friday, December 16, 2011 4:06 AM
    • Marked as answer by Sheldon _Xiao Tuesday, December 27, 2011 6:21 AM
    Friday, December 16, 2011 3:45 AM
  • Hi Raghav-MSDN,

    I think ChrisMathews has answered your question, firstly, get the selection range, then applyPropertyvalue, refer to below code:

    var textRange = test.Selection;
    textRange.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(Colors.Blue));
    

    On the other hand, you could start a new thread for new question, then more people will jump in, and provide you solutioin.

     

    Best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Sheldon _Xiao Tuesday, December 27, 2011 6:21 AM
    Tuesday, December 20, 2011 7:27 AM

All replies

  • Hi Raghav,
    U can use the following to select the particular text:

    RichTextBox.Selection Propety

    • Proposed as answer by Barot Bhavik Friday, December 16, 2011 4:05 AM
    • Marked as answer by Sheldon _Xiao Tuesday, December 27, 2011 6:22 AM
    Thursday, December 15, 2011 2:08 PM
  • i want to change background color for particular text how can i change ?
    Thanks & Regards, With Raghav
    • Proposed as answer by ChrisMathews Friday, December 16, 2011 3:35 AM
    • Unproposed as answer by ChrisMathews Friday, December 16, 2011 3:35 AM
    Friday, December 16, 2011 3:21 AM
  • Hi Raghav,

     

    Again a property of RichTextBox should do that:

    RichTextBox.SelectionBrush

    You can also go through the following links for more info:

    http://forums.whirlpool.net.au/archive/719811

    http://stackoverflow.com/questions/5442067/change-color-and-font-for-some-part-of-text-in-wpf-c-sharp

     

    Hope i've answered your previous query as well, if so, please mark it as answer.

     

    Cheers,

    Chris

    • Proposed as answer by Barot Bhavik Friday, December 16, 2011 4:06 AM
    • Marked as answer by Sheldon _Xiao Tuesday, December 27, 2011 6:21 AM
    Friday, December 16, 2011 3:45 AM
  • Hi Raghav-MSDN,

    I think ChrisMathews has answered your question, firstly, get the selection range, then applyPropertyvalue, refer to below code:

    var textRange = test.Selection;
    textRange.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(Colors.Blue));
    

    On the other hand, you could start a new thread for new question, then more people will jump in, and provide you solutioin.

     

    Best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Sheldon _Xiao Tuesday, December 27, 2011 6:21 AM
    Tuesday, December 20, 2011 7:27 AM