Button.IsDefault 屬性

定義

取得或設定值,這個值表示 Button 是否為預設按鈕。 使用者可按 ENTER 鍵來叫用預設按鈕。

public:
 property bool IsDefault { bool get(); void set(bool value); };
public bool IsDefault { get; set; }
member this.IsDefault : bool with get, set
Public Property IsDefault As Boolean

屬性值

如果 Button 是預設按鈕,則為 true,否則為 false。 預設為 false

範例

下列範例示範如何將按鈕指定為預設按鈕。

<Button Name="btnDefault" IsDefault="true" Click="OnClickDefault">OK</Button>

備註

當您將 IsDefault 按鈕的 屬性設定為 true 時,您會向 AccessKeyManager 註冊按鈕,讓使用者可以按 ENTER 鍵來叫用按鈕。

相依性屬性資訊

識別碼欄位 IsDefaultProperty
中繼資料屬性設定為 true

適用於