Toggle button used to change the state.
xaml
<StackPanel>
<ToggleButton x:Name="tbtnGender" Checked="tbtnGender_GenderChanged" Unchecked="tbtnGender_GenderChanged" IsThreeState="True" Content="Gender: "></ToggleButton>
<TextBlock x:Name="tblGender"></TextBlock>
</StackPanel>
c#
private void tbtnGender_GenderChanged(object sender, RoutedEventArgs e)
{
this.SetGenderText();
}
private void SetGenderText()
{
switch (this.tbtnGender.IsChecked)
{
case null:
this.tblGender.Text = "Not specified";
break;
case true:
this.tblGender.Text = "Male";
break;
case false:
this.tblGender.Text = "Female";
break;
}
}
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Sandeep ShekhawatPosted Jun 22, 2011, 7:34 AM
Sorry Gomathi Palaniswamy . Your Silverlight blog Series is a good effort no doubt. But i have a request you can explain terms that are using in your blog. like by comment, How use, Where use, Why use something i feel you can more explain these blogs.