ListBoxItem.IsSelected 屬性

定義

取得或設定值,該值指出 ListBoxItem 是否已選取。

public:
 property bool IsSelected { bool get(); void set(bool value); };
[System.ComponentModel.Bindable(true)]
public bool IsSelected { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.IsSelected : bool with get, set
Public Property IsSelected As Boolean

屬性值

Boolean

如果選取項目,則為 true,否則為 false。 預設為 false

屬性

範例

下列範例示範如何在建立清單方塊時設定要選取的清單方塊專案。

<ListBoxItem Name="item0" IsSelected="true">Item 0</ListBoxItem>

備註

若要在 中 ListBox 選取 ListBoxItem ,請將此屬性設定為 true

相依性屬性資訊

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

適用於