KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've got some RadioButtons in my XAML... <StackPanel> <RadioButton Name="RadioButton1" GroupName="Buttons" Click="ButtonsChecked" IsChecked="True">One</RadioButton> <RadioButton Name="RadioButton2" GroupName="Buttons" Click="ButtonsChecked">Two</RadioButton> <RadioButton Name="RadioButton3" GroupName="Buttons" Click="ButtonsChecked">Three</RadioButton> </StackPanel> And I can handle their click events in the Visual Basic code. This works... Private Sub ButtonsChecked(ByVal sender As System.Object, _ ByVal e As System.Windows.RoutedEventArgs) Select Case CType(sender, RadioButton).Name Case "RadioButton1" 'Do something one Exit Select Case "RadioButton2" 'Do something two Exit Select Case "RadioButton3" 'Do something three Exit Select End Select End Sub But, I'd like to improve it. This code fails... <StackPanel> <RadioButton Name="RadioButton1" GroupName="Buttons" Click="ButtonsChecked" Command="one" IsChecked="True">One</RadioButton> <RadioButton Name="RadioButton2" GroupName="Buttons" Click="ButtonsChecked" Command="two">Two</RadioButton> <RadioButton Name="RadioButton3" GroupName="Buttons" Click="ButtonsChecked" Command="three">Three</RadioButton> </StackPanel> Private Sub ButtonsChecked(ByVal sender As System.Object, _ ByVal e As System.Windows.RoutedEventArgs) Select Case CType(sender, RadioButton).Command Case "one" 'Do something one Exit Select Case "two" 'Do something two Exit Select Case "three" 'Do some
Tags (comma-separated)
Save Edits
Cancel