Click here to Skip to main content
15,668,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello experts.I've written a WPF activity library.In one of activities I used a TreeView to show some information in it like this :
<TreeView x:Name= "myTreeView" Grid.Row="0" FontFamily="Tahoma" FontSize="10">
                    <TreeViewItem Header="Item 1">
                        <TreeViewItem Header="Item 11" >
                            <TreeViewItem Header="Item 111"/>
                            <TreeViewItem Header="Item 112" />
                        <TreeViewItem Header="Item 12" >
                            <TreeViewItem Header="Item 121" />
                            <TreeViewItem Header="Item 122" />
                            <TreeViewItem Header="Item 123" />
                        <TreeViewItem Header="Item 13" >
                            <TreeViewItem Header="Item 131" />
                            <TreeViewItem Header="Item 132" />

And my property in Code-Activity side is like this :
public InArgument<TreeViewItem> Branch { 
            get{return _branch;} 
                if (this._branch != value)
                    this._branch = value;

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
            if (this.PropertyChanged != null)
                                new PropertyChangedEventArgs(propertyName));

I need when user clicked on one of the TreeView items, I send that item to my property(I want to bind it to Branch property).
How can I do it?

1 solution

you can define <treeviewitem mouseleftbuttondown="treeItem_MouseLeftButtonDown" />
then you get item and send to any where.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900