How to create image water mark in textbox using wpf?

Total Post:108

Points:756
WPF 
WPF
 1511  View(s)
Ratings:
Rate this:

How to create image water mark in textbox using wpf?

  1. Post:105

    Points:735
    Re: How to create image water mark in textbox using wpf?

    Hi !

    You can set the background image in textbox and write the below code in textbox text change event:-

    private void txtSearch_TextChanged(object sender, TextChangedEventArgs e)
            {
                if (txtSearch.Text != "")
                {
                    this.txtSearch.Background = null;
                }
                else
                {
                    ImageBrush mybrush = new ImageBrush();
                    mybrush.ImageSource = new BitmapImage(new Uri("Image Path"));
                    this.txtSearch.Background = mybrush;
                }
            }

    thanks

      Modified On Mar-30-2018 05:50:20 AM

Answer