Guest User

Untitled

a guest
Aug 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. how to set image in textbox in wpf
  2. <TextBox Name="myTextBox" TextChanged="OnTextBoxTextChanged" Width="200">
  3. <TextBox.Background>
  4. <ImageBrush ImageSource="TextBoxBackground.gif" AlignmentX="Left" Stretch="None" />
  5. </TextBox.Background>
  6. </TextBox>
  7.  
  8. // Create an ImageBrush.
  9. ImageBrush textImageBrush = new ImageBrush();
  10. textImageBrush.ImageSource = new BitmapImage(new Uri(@"TextBoxBackground.gif", UriKind.Relative));
  11. textImageBrush.AlignmentX = AlignmentX.Left;
  12. textImageBrush.Stretch = Stretch.None;
  13. // Use the brush to paint the button's background.
  14. myTextBox.Background = textImageBrush;
Add Comment
Please, Sign In to add comment