TreeViewItem.IsSelected 屬性

定義

取得或設定是否要選取 TreeViewItem 控制項。

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

屬性值

如果已選取 TreeViewItem,則為 true,否則為 false。 預設為 false

範例

下列範例會示範如何設定 IsSelected 屬性。

EmployeeWorkDays.IsSelected = true;
EmployeeWorkDays.IsSelected = True
<TreeViewItem Header="Work Days" 
              Name="EmployeeWorkDays"
              IsSelected="True">

備註

IsSelected當 屬性值變更為 true 時,就會 Selected 發生 事件。 IsSelected當 屬性值變更為 false 時,就會 Unselected 發生 事件。

相依性屬性資訊

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

適用於

另請參閱