Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have generate TreeViewitem in xaml.

My problem : i have click in child treeviewitem click event and call to both event (Child Event and Parent Event).

how to implement to click in child treeviewitem call only child event and click in parent event click call only parant event .

please help me

below Code sucesfully run but click in child event then call first parent event and then after call child event then in display on childevent so please tell me how to solved Show only click in clicking event.

What I have tried:

xaml

<treeview>
<TreeViewItem Name="Test" IsExpanded="True" PreviewMouseUp="Test_PreviewMouseUp">
<TreeViewItem Name="Test1" PreviewMouseUp="Test1_PreviewMouseUp"/>
<TreeViewItem Name="Test2" PreviewMouseUp="Test2_PreviewMouseUp"/>


<treeview>

xaml.cs

private void Test_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
//in below Code is path of viewmodel and view
var view = new ERPAPPLICATION.Modules.SalesAndMarketing.SalesAndMarktingDaskView();
var vm = new ERPAPPLICATION.Modules.SalesAndMarketing.SalesAndMarktingDaskViewModel();

vm.WinView = view;
view.DataContext = vm;
}

private void Test1_MouseUp(object sender, MouseButtonEventArgs e)
{
var view = new ERPAPPLICATION.Modules.SalesAndMarketing.SalesLeads.SalesLeadCollectionView();
var vm = new Modules.SalesAndMarketing.SalesLeads.SalesLeadCollectionViewModel(view);

vm.View = view;
view.DataContext = vm;

AddDocumentToMdi(view, "SalesLeadCollectionView", "Sales & Marketing -> Transaction -> Lead", false);
Dispatcher.BeginInvoke(new Action(() => (sender as FrameworkElement).Focus()), DispatcherPriority.Loaded);


}
Posted

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