我想在windows phone 8.1中創建一個圓角半徑爲20.0的圖像按鈕,但是我找不到任何解決方案,任何人都可以建議我採用這種方法?(Windows phone 8.1)在windows phone 8.1創建圓角圖像按鈕
的按鈕看起來像:
我想在windows phone 8.1中創建一個圓角半徑爲20.0的圖像按鈕,但是我找不到任何解決方案,任何人都可以建議我採用這種方法?(Windows phone 8.1)在windows phone 8.1創建圓角圖像按鈕
的按鈕看起來像:
您可以使用Border元素
<Border BorderBrush="Red" BorderThickness="2" CornerRadius="20" HorizontalAlignment="Left" >
<Button BorderThickness="0" Click="Button_Click" >
<Button.Background>
<ImageBrush ImageSource="Assets/cart.png" Stretch="Uniform"/>
</Button.Background>
</Button>
</Border>
試試這個
<Button HorizontalAlignment="Left" Margin="47,636,0,0" >
<Button.Template>
<ControlTemplate>
<Border BorderBrush="#6BA92A" Background="#6BA92A" CornerRadius="20,20,20,20" BorderThickness="2">
<Button Content="Add to cart"
Background="{TemplateBinding Background}"
Height="65"
Width="348"
FontSize="{TemplateBinding FontSize}"
BorderBrush="#6BA92A">
</Button>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
我已經解決了這個問題,這裏是我的代碼:
<Rectangle Grid.Row="3" Margin="20,0,20,20" HorizontalAlignment="Stretch" Height="50" RadiusX="10" RadiusY="10" > <Rectangle.Fill>
<ImageBrush Stretch="Fill" ImageSource="/Assets/images/add_cart_btn_bg.png"/>
</Rectangle.Fill> </Rectangle>