如何取消代码隐藏中的 Accordion.SelectionChanged?
我正在使用 silverlight 工具包 Accordion 控件。
我想根据某种逻辑取消手风琴选择。
例如:
private void Accordion_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if(Something) {
e.SelectedItem = -1; //or anything that cancels the accordion "expansion"
return;
}
}
此代码会导致对 Accordion_SelectionChanged 的无限次调用,即使第一个递归调用不会影响所选项目。
还有其他方法可以做到这一点吗?
塔克斯
I'm using the silverlight toolkit Accordion control.
I want to cancel an accordion selection based on some logic.
For example:
private void Accordion_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if(Something) {
e.SelectedItem = -1; //or anything that cancels the accordion "expansion"
return;
}
}
This code results in infinity calls to Accordion_SelectionChanged, even though the first recursive call do not affect the selected item.
Any other way to do this?
Tks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以手动阻止递归调用,如下所示:
You can manually prevent the recursive calls as follow: