HOW TO CREATE IMAGE WATER MARK IN TEXTBOX USING WPF?

john rob

Total Post:108

Points:756
Posted by  john rob
WPF 
WPF
 1353  View(s)
Ratings:
Rate this:

How to create image water mark in textbox using wpf?

  1. shreesh chandra shukla

    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

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!