【发布时间】:2014-11-06 09:41:08
【问题描述】:
如果我想将图像设置为文本框的背景,我可以在 axml 中使用此代码:
<Grid>
<Grid.Background>
<ImageBrush ImageSource="MyImage.jpg" />
</Grid.Background>
<TextBlock Text="Some Text" />
</Grid>
但是,我正在代码中创建一个 TextBlock,我正在尝试:
TextBox myTextBox = new TextBox();
但是这种方式我不知道如何访问 ImageBrush 属性。
在代码中添加背景的方法是什么?
非常感谢。
【问题讨论】:
标签: wpf textbox background-image