How to handle nested UI Process in WPF c#

  • Thread starter Thread starter Magi02
  • Start date Start date
M

Magi02

Guest
I have two listview controls are placed in two WPF windows respectively, first listview is in main window of application, if click the its child listview item it will trigger to open the child window which has my second listview control, it my application architecture.

My Query is

How to handle two nested UI process programmatically

  1. I need to select all listview item programmatically in main window with corresponding child window.

Example: In Main Window, If first listview item is being selected, then it triggers its child window to open and it need to select all listview items in child window, once it is completed , now child window needs to close then , next list view item needs to be select in main window.

Currently following below methods to achieve this, but fails

Code


private void MainWindowLoaded(object param) {

ListView listView = param as ListView;

foreach(ListViewItem item in listView.Items) {
DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>{
foreach(var window in this.ChildWindows) {
window.Close();
}
listView.SelectedItem = item;

}), System.Windows.Threading.DispatcherPriority.Normal);
}

}

private void ChildWindowLoaded(object param) {
ListView listView = param as ListView;

foreach(ListViewItem item in listView.Items) {
DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>{

listView.SelectedItem = item;

}), System.Windows.Threading.DispatcherPriority.Loaded);
}
}




Any alternate way to achieve my requirement?

Continue reading...
 
Back
Top