Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
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"];
                }
            }
        }

so any ideas of what could be causing the problem.
Note: I have declared my AppBars in the PhoneApplicationPage Resources.
Posted
Updated 10-Nov-14 22:41pm
v5
Comments
BillWoodruff 10-Nov-14 12:03pm    
If this is a Win Phone app, please tag your question appropriately.
job mwa 10-Nov-14 13:51pm    
tnx

1 solution

i solved this by using the Windows Phone Toolkit(Kinnara's fork) Apparently the
C#
CustomMessageBox
was causing the error. if you encounter such a bug make sure to use another toolkit and see if it solves the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900