Quantcast
Viewing all articles
Browse latest Browse all 18858

Treeview selected item

Hi, I have a TreeView (C_Tree) with a 2 levels of items (TVIs collection of TVI). TVI is a class with Selected, which allow me to find selected item in a tree. Situation is I can read this but I cant set it. When I brows my TreeView and click it or use a keyboard, I can identify selected item, but, as soon as I set it in a code like TVIs(0).Selected=True nothing happens. Why?

Dim TVIs As New ObservableCollection(Of TVI) C_Tree.ItemsSource = TVIs Public Class TVI Implements INotifyPropertyChanged Private tvi_selected As Boolean Public Property Selected() As Boolean Get Return tvi_selected End Get Set(value As Boolean) tvi_selected = value RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("tvi_selected")) End Set End Property Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged End Class

<Style TargetType="TreeViewItem">
<Setter Property="IsSelected" Value="{Binding Selected}"/>
</Style>



Aleksey



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>