0

I'm trying to change color of the rest of the text after a bullet "●". User writes some text in a TextBox's field and the result will be display in a TextBlock after clicking a Button (Button_Click Event). What am I doing wrong or missing right here?

    TextBlock inputTxt = new TextBlock();

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      if (txtBox != null)
      {
        if (txtBox.Text.StartsWith("●"))
          {
            inputTxt.Text = txtBox.Text.Substring(2);
            inputTxt.Foreground = Brushes.Blue;

            txtBlock.Text = bullet + inputTxt.Text;
          }
            else txtBlock.Text = txtBox.Text;
      }
     }`


Thank you. 


![Example :](https://i.stack.imgur.com/9cCDj.png)![1][1]


[1]: https://i.stack.imgur.com/9cCDj.png
Dôn Kayt
  • 103
  • 1
  • 10
  • 1
    What does this method currently do? Doesn't it change the color at all or just not the way you want it to? And could you provide an example of an input string and a description how it's supposed to look like? – Tomsen Nov 27 '20 at 08:58
  • @Tomsen I add a picture as an example, please take a look at it. – Dôn Kayt Nov 27 '20 at 09:42

0 Answers0