我有一个 TextBox 控件,我希望能够设置背景图像和背景颜色。
目前我可以设置一个,或者另一个,但不能同时设置。当我尝试同时设置两者时,我收到“属性'背景'设置不止一次”错误。
这是我使用的代码:
<TextBox Name="tbImageTextBox">
<TextBox.Background>
<ImageBrush ImageSource="/Resources/Images/image.png"
AlignmentX="Right" Stretch="None"/>
<SolidColorBrush>#FF8D8A8A</SolidColorBrush>
</TextBox.Background>
</TextBox>
我还尝试在 TextBox 的样式和 中的图像中设置背景颜色<TextBox.Background>
,但颜色被忽略。