我有一个图像和 TextBlock 的水平 StackPanel。我需要完成的是将两者的前景更改为某种颜色。我可以使用 Foreground 属性轻松更改 TextBlock,但我不确定如何使用 Image 执行此操作。该图像只是一个基本的应用程序图标。
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/Icons/appbar.book.perspective.png" Width="50" Height="50" Margin="-8,0,-6,0"/>
<TextBlock Text="BOOK" VerticalAlignment="Center" Foreground="Blue"/>
</StackPanel>
最佳答案
BitmapIcon 对您可以使用的内容很有帮助:
<BitmapIcon Width="20" Height="20" Foreground="Red" UriSource="ms-appx:///Assets/Resources/YourImage.png" />
这是我的风格...:)
关于image - 如何更改 View 中图像的前景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20987584/