简体   繁体   English

如何在Windows Phone应用中重置单选按钮的边框粗细?

[英]How to reset the border thickness of a radio button in windows phone app?

The xaml code for the radio button is, 单选按钮的xaml代码是,

<RadioButton x:Name="RadioButton1" BorderBrush="#b2b2b2" IsChecked="true" Foreground="Black" BorderThickness="0.5" Background="White" Content="Taxable" HorizontalAlignment="Left" Height="78" Margin="0,0,0,0"  Width="164"/>

But there is no change in the border thickness, what ever the value i give. 但是边框厚度没有改变,无论我给什么值。 How can this problem be solved, i just want to change the borderthickness of the radio button(FYI - Borderbrush works fine). 如何解决此问题,我只想更改单选按钮的边框厚度(仅供参考-Borderbrush可以正常工作)。

You're going to need to retemplate the RadioButton if you want to change that. 如果要更改RadioButton按钮,则需要重新模板化。

The default template has the background circle defined like this: 默认模板的背景圆定义如下:

<Ellipse x:Name="CheckBackground" Fill="{TemplateBinding Background}" 
         HorizontalAlignment="Left" Height="25.5" IsHitTestVisible="False" 
         Stroke="{TemplateBinding BorderBrush}" 
         StrokeThickness="{ThemeResource PhoneStrokeThickness}" 
         VerticalAlignment="Center" Width="25.5"/>

Notice that the StrokeThickness property is set to a ThemeResource , not to a TemplateBinding the way Stroke is. 请注意, StrokeThickness属性设置为ThemeResource ,而不是设置为StrokeTemplateBinding

Try this 尝试这个

            <Border BorderBrush="#b2b2b2" BorderThickness="10.0" Width="164">
                <RadioButton x:Name="RadioButton1"  IsChecked="true" Foreground="Black" Content="Taxable" HorizontalAlignment="Left" Height="78" Margin="0,0,0,0" Width="164"/>
            </Border>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM