1

Windows Phone 7: How do I make a radiobutton look like a toggle button? I am trying to get the selected radio button to look like a depressed button.

Basically I have a filter by 'FName', 'LName' radio button over my list of names. RadioButton takes up too much screen space. A depressed button will save the space used by the 'O'

2 Answers 2

1

You can try changing your Xaml to specify a ToggleButton which is the base class for RadioButtons and CheckBox's, but since it is a ToggleButton you will have to interlock them in the Checked and UnChecked events. See this article and this MSDN information. Your only other option would be to create a new Style for your RadioButtons.

From:

<RadioButton  Content="First Name" Height="72" HorizontalAlignment="Left" Margin="38,92,0,0" Name="FName" VerticalAlignment="Top" Width="102" />

To:

<ToggleButton Content="First Name" Height="72" HorizontalAlignment="Left" Margin="38,92,0,0" Name="FName" VerticalAlignment="Top" Width="102" />
2
  • Bottom line: just use the ToggleButton class.
    – Den
    Commented Jul 16, 2012 at 1:49
  • @DennisDelimarsky Yes you could summarize it as that, I did want the OP to be aware that ToggleButton behavior is different than RadioButton behavior and he will need to do his own interlocking.
    – Mark Hall
    Commented Jul 16, 2012 at 1:59
1

You can only do this if you overwrite the template radio button.

In WPF, we can use the following "hack":

<RadioButton Style="{StaticResource {x:Type ToggleButton}}" />

I believe that this does not work for WP7. I suggest you create your own style of 0. You can use the Expression Blend to facilitate your work. Look about writing styles that should help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.