我需要为我的应用程序创建一个图像按钮,例如面向 Web 的样式。我有一个 20x20 像素的图像,并且想要一个与图像尺寸相同的图像按钮。
我试图在我的 xaml 中设置它,但它不起作用:
<Button Grid.Row="0" Margin="0" Padding="0" Click="AddtoFavorite_Click" Width="20" Height="20" VerticalAlignment="Top" HorizontalAlignment="Right">
<Button.Content>
<Image Source="/MyNamespace;component/images/star_yellow.png" Margin="0" Width="20" Height="20" />
</Button.Content>
</Button>
怎么了?
解决方案
我发现最好的解决方案是:
<Image Source="/MyNamespace;component/images/star_yellow.png" ManipulationStarted="Image_ManipulationStarted" Width="20" Height="20"></Image>
谢谢大家!