Answer the question
In order to leave comments, you need to log in
How to add actions to event handlers of standard components?
I'm trying to implement my Control inherited from TreeViewItem
public class TreeViewItemExt : TreeViewItem
{
}
Answer the question
In order to leave comments, you need to log in
Figured out the issue:
public class TreeViewItemExt : TreeViewItem
{
public TreeViewItemExt()
: base()
{
this.Selected += new RoutedEventHandler(msg);
}
public void msg(object sender, RoutedEventArgs e)
{
MessageBox.Show("TreeViewItemExt Works!");
}
}
to change the selected element
Option 1: WPF has an EventTrigger that allows you to do whatever you want.
2nd use MVVM and interface INotifyPropertyChanged and binding
3rd option you have already been answered, use standard event SelectedItemChanged.
4th binding on SelectedItem, the selected element will come to the setter
PS Or rather 1 + 3
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question