我需要为我的应用程序创建一个像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>
感谢所有人!