ToggleButton.Checked Event
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when a ToggleButton is checked.
public:
event System::Windows::RoutedEventHandler ^ Checked;
C#
public event System.Windows.RoutedEventHandler Checked;
member this.Checked : System.Windows.RoutedEventHandler
Public Custom Event Checked As RoutedEventHandler
The following example changes subscribes to the Checked and UncheckedEvent events to change the FontStyle of the TextBlock, textBlock1
.
XAML
<CheckBox Name="chkbox" Content="Italicize text"
Checked="chkbox_Checked"
Unchecked="chkbox_Unchecked"/>
<TextBlock Name="textBlock1" FontSize="14">
The quick brown fox jumps over the lazy dog.
</TextBlock>
C#
void chkbox_Unchecked(object sender, RoutedEventArgs e)
{
textBlock1.FontStyle = FontStyles.Normal;
}
void chkbox_Checked(object sender, RoutedEventArgs e)
{
textBlock1.FontStyle = FontStyles.Italic;
}
Private Sub chkbox_Unchecked(ByVal sender As Object, ByVal e As RoutedEventArgs)
textBlock1.FontStyle = FontStyles.Normal
End Sub
Private Sub chkbox_Checked(ByVal sender As Object, ByVal e As RoutedEventArgs)
textBlock1.FontStyle = FontStyles.Italic
End Sub
Item | Value |
---|---|
Identifier field | CheckedEvent |
Routing strategy | Bubbling |
Delegate | RoutedEventHandler |
Produkt | Versioner |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.
Feedback om .NET
.NET är ett öppen källkod projekt. Välj en länk för att ge feedback: