如果单选按钮被禁用,则第一次在 windows phone 7 的单选按钮中应用前景色。
这是我的代码-
RadioButton1.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 100, 0));//Green
RadioButton2.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));//White
RadioButton3.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
RadioButton4.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
RadioButton1.IsEnabled = false;
RadioButton1.IsChecked = true;
RadioButton2.IsEnabled = false;
RadioButton3.IsEnabled = false;
RadioButton4.IsEnabled = false;
这是我的 xaml
<StackPanel x:Name="panel" Orientation="Vertical" >
<RadioButton x:Name="RadioButton1">
<RadioButton.Content>
<TextBlock Text="" x:Name="RadioButton1Text" TextWrapping="Wrap" />
</RadioButton.Content>
</RadioButton>
<RadioButton x:Name="RadioButton2">
<RadioButton.Content>
<TextBlock Text="" x:Name="RadioButton2Text" TextWrapping="Wrap" />
</RadioButton.Content>
</RadioButton>
<RadioButton x:Name="RadioButton3">
<RadioButton.Content>
<TextBlock Text="" x:Name="RadioButton3Text" TextWrapping="Wrap" />
</RadioButton.Content>
</RadioButton>
<RadioButton x:Name="RadioButton4">
<RadioButton.Content>
<TextBlock Text="" x:Name="RadioButton4Text" TextWrapping="Wrap" />
</RadioButton.Content>
</RadioButton>
</StackPanel>