0

I'm using a TreeView that contain several items:

<TreeViewItem Header="PL3 Line 1" IsExpanded="true"> <TreeViewItem Header="Live Update" Selected="TreeViewItem_Selected" Height="20" Width="98"/> <TreeViewItem Header="Archives" Selected="TreeViewItem_Selected_1"/> <TreeViewItem Header="Archives / days" Selected="TreeViewItem_Selected_100"></TreeViewItem/> 

and I want to add different icon to each item, I have tried it by using a StackPanel:

<TreeViewItem> <TreeViewItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="../Images/japan.png"></Image> <Label Content="Japan"></Label> </StackPanel> </TreeViewItem.Header> </TreeViewItem> 

but when I click on it, the event "Selected is not triggered.

1 Answer 1

1

In your example you did not specify the Selected event. It should be something like:

<TreeViewItem Selected="SelectedEvent"> <TreeViewItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="../Images/japan.png"></Image> <Label Content="Japan"></Label> </StackPanel> </TreeViewItem.Header> </TreeViewItem> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.