只是想做一個很簡單的圖片按鈕而已,不需要那么復雜。
<Button x:Name="btn" Width="145" Height="30" HorizontalAlignment="Center" Margin="5" VerticalAlignment="Top" Command="{Binding BtnCommand}"> <Button.Background> <ImageBrush ImageSource="圖片路徑" Stretch="Fill"/> <!--如"/項目名;component/Presentation/Resources/Images/1.png"--> </Button.Background> </Button>
坑點:
如果Visual Studio報錯說在Button下找不到Background屬性,那是因為圖片路徑填寫錯了!
