93 可读性
 将光标移到/点击文章中的句子上,可以查看译文。      显示繁体中文内容    显示简体中文内容

.net - Trying find how to cancel TabControl.SelectionChanged in silverlight
在silverlight中,.NET 尝试查找如何取消 TabControl.SelectionChanged

137 2

I am trying figure out how cancel this event in silverlight, sadly i didn't find any useful link with the solution :( (i saw some post for wpf wich i think are not longer available for silverlight )

时间:原作者:0个回答

124 5

Here is the bare bones of it: -

 bool cancellingTabSelectionChange = false;
 private void tabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
 if (e.RemovedItems.Count> 0 &&!cancellingTabSelectionChange)
 {
 cancellingTabSelectionChange = true;
 ((TabControl)sender).SelectedItem = e.RemovedItems[0];
 cancellingTabSelectionChange = false;
 }
 }

You would need to add the extra criteria the would allow a change to take place since the above code would always block a change of tab.

原作者:
...