同一应用程序页面上的多个应用程序栏无效

编程入门 行业动态 更新时间:2024-10-28 22:27:03
本文介绍了同一应用程序页面上的多个应用程序栏无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个页面,其中包含一个带复选框的List,并且每次我检查一个项目从一个AppBar切换到另一个有删除的项目时,它绑定到一个ObservableCollection 按钮,我正在使用collectionChanged事件来触发此切换,我的问题是当我删除一个项目并且缺陷属性现在为false时删除按钮仍然存在,它不会切换回默认的AppBar ..这是我的CollectionChanged事件:

I have a page that has a List with checkboxes and its bound to an ObservableCollection everytime i check an item it switches from one AppBar to another that has a delete button, i am using a collectionChanged event to trigger this switching, my problem is when i delete an item and the ischecked property is now false the delete button still remains, it doesn't switch back to the default AppBar..here is my CollectionChanged event:

void MyItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (MyItems item in e.NewItems) { item.PropertyChanged += item_PropertyChanged; } } if (e.OldItems != null) { foreach (MyItems item in e.OldItems) { item.PropertyChanged -= item_PropertyChanged; } } } void item_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "IsChecked") { if (MyItems.Any(i => i.IsChecked == true)) { ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources["AppBarChecked"]; } else { ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources["AppBarNotChecked"]; } } }

所以任何可能导致问题的想法。 注意:我已经在PhoneApplicationPage Resources中声明了我的AppBars。

so any ideas of what could be causing the problem. Note: I have declared my AppBars in the PhoneApplicationPage Resources.

推荐答案

我通过使用Windows Phone Toolkit(Kinnara的fork)解决了这个问题显然 i solved this by using the Windows Phone Toolkit(Kinnara's fork) Apparently the CustomMessageBox

导致了错误。如果遇到这样的错误,请确保使用其他工具包,看看它是否解决了问题。

was causing the error. if you encounter such a bug make sure to use another toolkit and see if it solves the problem.

更多推荐

同一应用程序页面上的多个应用程序栏无效

本文发布于:2023-10-30 03:11:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541594.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   多个   页面

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!