コード例 #1
0
        private void OnAddressEditorTagRemoved(object sender, RoutedEventArgs e)
        {
            if (_changedSelectedItemsInternal)
            {
                return;
            }
            C1Tag removeTag = sender as C1Tag;

            if (removeTag != null)
            {
                int removeIndex = MyIndexOf((string)removeTag.Content);
                if (removeIndex >= 0)
                {
                    Mail     removeMail    = Mails[removeIndex];
                    object[] selectedItems = ContactList.SelectedItems as object[];
                    var      list          = selectedItems.ToList();
                    list.Remove(removeMail);
                    _changedSelectedItemsInternal = true;
                    ContactList.SelectedItems     = list.ToArray();
                    _changedSelectedItemsInternal = false;
                }
            }
        }
コード例 #2
0
        private void OnAddressEditorTagInserted(object sender, RoutedEventArgs e)
        {
            if (_changedSelectedItemsInternal)
            {
                return;
            }
            SuggestListPopup.IsOpen = false;
            C1Tag addedTag = sender as C1Tag;

            if (addedTag != null)
            {
                int addIndex = MyIndexOf((string)addedTag.Content);
                if (addIndex >= 0)
                {
                    Mail     addMail       = Mails[addIndex];
                    object[] selectedItems = ContactList.SelectedItems as object[];
                    var      list          = selectedItems == null ? new List <object>() : selectedItems.ToList();
                    list.Add(addMail);
                    _changedSelectedItemsInternal = true;
                    ContactList.SelectedItems     = list.ToArray();
                    _changedSelectedItemsInternal = false;
                }
            }
        }