共用方式為


ToggleButton.Checked 事件

定義

ToggleButton 處於核取狀態時發生。

public:
 event System::Windows::RoutedEventHandler ^ Checked;
public event System.Windows.RoutedEventHandler Checked;
member this.Checked : System.Windows.RoutedEventHandler 
Public Custom Event Checked As RoutedEventHandler 

事件類型

範例

下列範例變更會 Checked 訂閱 和 UncheckedEvent 事件,以變更 FontStyletextBlock1TextBlock

<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>
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

備註

路由事件資訊

識別碼欄位 CheckedEvent
路由策略 鼓 泡
代理人 RoutedEventHandler

適用於