如何增加单选按钮的大小

时间:2017-10-06 13:47:09

标签: c# .net wpf xaml

我不是C#的新手,但我是XAML / MVVM的新手。

我正在开发一个触摸屏应用程序。它有许多单选按钮,但我需要它们更大,这样当有人接触它们时,它们会被检查。

我不介意单选按钮周围的区域设置支票或单选按钮的实际尺寸是否增加。

这是我的单选按钮代码。大约有20个,所以最少的代码可能是最好的。

<RadioButton HorizontalAlignment="Center" VerticalAlignment="Center" GroupName="History" Grid.Column="2" Grid.Row="3" Command="{Binding HealthQuestionsTrue}" CommandParameter="MedicalHistory"></RadioButton>
<RadioButton HorizontalAlignment="Center" VerticalAlignment="Center" GroupName="History" Grid.Column="3" Grid.Row="3" Command="{Binding HealthQuestionsFalse}" CommandParameter="MedicalHistory"></RadioButton>

1 个答案:

答案 0 :(得分:0)

为其分配一个id并调整css中的大小,或者是否以相同的方式更改它们以分配cssclass并同样更改css。

e.g。

<RadioButton ID="Button1 "HorizontalAlignment="Center" VerticalAlignment="Center" GroupName="History" Grid.Column="2" Grid.Row="3" Command="{Binding HealthQuestionsTrue}" CommandParameter="MedicalHistory"></RadioButton>

<RadioButton CSSClass="buttons" "HorizontalAlignment="Center" VerticalAlignment="Center" GroupName="History" Grid.Column="2" Grid.Row="3" Command="{Binding HealthQuestionsTrue}" CommandParameter="MedicalHistory"></RadioButton>

并且css将是

#Button1{
    width:50px;
}

OR

.buttons{
    width:50px;
}