Skip to main content
added 572 characters in body
Source Link
Ramin
  • 2.1k
  • 14
  • 22

I think you should check SelectionChange.AddedItems and SelectionChange.RemovedItems to find the difference between these to firings. I guess that when you select a page, SelectionChange.RemovedItems==0 while when you click on a tabItem to select it, SelectionChange.RemovedItems==1. if so just write:

if (SelectionChange.RemovedItems==0) return; 

EditEdit1: Please see the first comment.

Edit 2

void tablcontrol_SelectionChange(object sender, SelectionChangedEventArgs e) { if (e.RemovedItems.Count == 0) { // I guess this is the event that happens when a page is selected // in this case just a TabItem is added to the selection // and nothing is removed, so do nothing return; } // if you are here, it means that this is another selection changed event // so Perform those tasks that you mentioned in your question } 

I think you should check SelectionChange.AddedItems and SelectionChange.RemovedItems to find the difference between these to firings. I guess that when you select a page, SelectionChange.RemovedItems==0 while when you click on a tabItem to select it, SelectionChange.RemovedItems==1. if so just write:

if (SelectionChange.RemovedItems==0) return; 

Edit: Please see the first comment.

I think you should check SelectionChange.AddedItems and SelectionChange.RemovedItems to find the difference between these to firings. I guess that when you select a page, SelectionChange.RemovedItems==0 while when you click on a tabItem to select it, SelectionChange.RemovedItems==1. if so just write:

if (SelectionChange.RemovedItems==0) return; 

Edit1: Please see the first comment.

Edit 2

void tablcontrol_SelectionChange(object sender, SelectionChangedEventArgs e) { if (e.RemovedItems.Count == 0) { // I guess this is the event that happens when a page is selected // in this case just a TabItem is added to the selection // and nothing is removed, so do nothing return; } // if you are here, it means that this is another selection changed event // so Perform those tasks that you mentioned in your question } 
added 43 characters in body
Source Link
Ramin
  • 2.1k
  • 14
  • 22

I think you should check SelectionChange.AddedItems and SelectionChange.RemovedItems to find the difference between these to firings. I guess that when you select a page, SelectionChange.RemovedItems==0 while when you click on a tabItem to select it, SelectionChange.RemovedItems==1. if so just write:

if (SelectionChange.RemovedItems==0) return; 

Edit: Please see the first comment.

I think you should check SelectionChange.AddedItems and SelectionChange.RemovedItems to find the difference between these to firings. I guess that when you select a page, SelectionChange.RemovedItems==0 while when you click on a tabItem to select it, SelectionChange.RemovedItems==1. if so just write:

if (SelectionChange.RemovedItems==0) return; 

I think you should check SelectionChange.AddedItems and SelectionChange.RemovedItems to find the difference between these to firings. I guess that when you select a page, SelectionChange.RemovedItems==0 while when you click on a tabItem to select it, SelectionChange.RemovedItems==1. if so just write:

if (SelectionChange.RemovedItems==0) return; 

Edit: Please see the first comment.

Source Link
Ramin
  • 2.1k
  • 14
  • 22

I think you should check SelectionChange.AddedItems and SelectionChange.RemovedItems to find the difference between these to firings. I guess that when you select a page, SelectionChange.RemovedItems==0 while when you click on a tabItem to select it, SelectionChange.RemovedItems==1. if so just write:

if (SelectionChange.RemovedItems==0) return;