If I want to set a image as background on a textBox I can use this code in the axml:
<Grid>
<Grid.Background>
<ImageBrush ImageSource="MyImage.jpg" />
</Grid.Background>
<TextBlock Text="Some Text" />
</Grid>
However, I am creating a TextBlock in code, I amtrying this:
TextBox myTextBox = new TextBox();
But in this way I don't know how to access to the ImageBrush property.
Which is the way to add a background in code?
Thank so much.
Provided that
MyImage.jpg
is a file in the application's current folder, you could writeIf it's a Resource File, you would have to use a Resource File Pack URI: