Beispiel #1
0
        private void OnCheckBoxCheckedChanged(object sender, PropertyChangedEventArgs e)
        {
            FriendWithCheckBox friendWithCheckBox = sender as FriendWithCheckBox;

            if (friendWithCheckBox.IsChecked)
            {
                if (!SelectedFriends.Contains(friendWithCheckBox.Friend))
                {
                    SelectedFriends.Add(friendWithCheckBox.Friend);
                }
            }
            else
            {
                if (SelectedFriends.Contains(friendWithCheckBox.Friend))
                {
                    SelectedFriends.Remove(friendWithCheckBox.Friend);
                }
            }
        }
Beispiel #2
0
        public void OnFriendTapped(object sender, SelectionChangedEventArgs args)
        {
            if (!args.CurrentSelection.Any())
            {
                return;
            }

            FriendWithCheckBox friendWithCheckBox = args.CurrentSelection[0] as FriendWithCheckBox;

            CollectionView cv = (CollectionView)sender;

            cv.SelectedItem = null;

            if (friendWithCheckBox.IsChecked)
            {
                SelectedFriends.Remove(friendWithCheckBox.Friend);
                friendWithCheckBox.IsChecked = false;
            }
            else
            {
                SelectedFriends.Add(friendWithCheckBox.Friend);
                friendWithCheckBox.IsChecked = true;
            }
        }