In our application we are having a user control that has tree view and this user control has been called in the main page.
Code is mentioned below.How can i get the tree view clicked node name in the main page. please help me. i am new to WPF.
I got the code how to write in user control but i don't know how to handle the user control routed event in main page.
Code in User control:
=============================
public static readonly RoutedEvent NavigateEvent = EventManager.RegisterRoutedEvent("CustomClick", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ucMainMenu));
public ucMainMenu()
{
InitializeComponent();
this.MenuTreeView.AddHandler(TreeView.MouseDoubleClickEvent, new RoutedEventHandler(CustomClick_RaiseEvent));
}
{
add
{
this.AddHandler(NavigateEvent, value);
}
remove
{
this.RemoveHandler(NavigateEvent, value);
}
}
public void CustomClick_RaiseEvent(object sender, RoutedEventArgs e)
{
RoutedEventArgs newEventArgs = new RoutedEventArgs(ucMainMenu.NavigateEvent);
this.RaiseEvent(newEventArgs);
}
private void MenuTreeView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
CustomClick_RaiseEvent(item , e);
}