---
title: "how to set image in textbox in wpf"  
description: "how to set image in textbox in wpf"  
author: "Hank Greenberg"  
published: 2013-07-18  
updated: 2013-07-18  
canonical: https://www.mindstick.com/forum/1316/how-to-set-image-in-textbox-in-wpf  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# how to set image in textbox in wpf

HI [mindstick](https://yourviews.mindstick.com/view/84668/how-mindstick-is-used-for-marketing-purposes)!

I Have [TextBox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview) In My [Application](https://www.mindstick.com/articles/12824/calculator-application-in-android) That I Want to [Add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript) [Image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) To This , Some Times

Like [Microsoft](https://www.mindstick.com/articles/12301/microsoft-is-trying-to-kill-passwords) [Office](https://www.mindstick.com/articles/13103/how-do-computer-desks-assist-in-the-office-work) [Word](https://www.mindstick.com/forum/305/read-word-file) I am Going To Have Both [Text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) And Image

Is it Possible ?

If It possible How?

Thanks.

## Replies

### Reply by shreesh chandra shukla

Solution!

From XAML:

```
<TextBox Name="myTextBox"
TextChanged="OnTextBoxTextChanged" Width="200"> 
<TextBox.Background>    <ImageBrush
ImageSource="TextBoxBackground.gif" AlignmentX="Left"
Stretch="None" /> 
</TextBox.Background></TextBox>
```

## From C#

```
// Create an ImageBrush.ImageBrush textImageBrush = new ImageBrush();textImageBrush.ImageSource = new BitmapImage(new
Uri(@"TextBoxBackground.gif", UriKind.Relative));textImageBrush.AlignmentX = AlignmentX.Left;textImageBrush.Stretch = Stretch.None;// Use the brush to paint the button's background.myTextBox.Background = textImageBrush;
```


---

Original Source: https://www.mindstick.com/forum/1316/how-to-set-image-in-textbox-in-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
