private static void UnregisterIfPossible(IList ientry, MultiSelector icontainer = null)
 {
     INotifyCollectionChanged inc = ientry as INotifyCollectionChanged;
     if (inc != null)
     {
         inc.CollectionChanged -= inc_CollectionChanged;
         if (icontainer != null)
             _Mapped.Remove(inc);
     }
 }
 private static void RegisterIfPossible(IList ientry, MultiSelector icontainer = null)
 {
     INotifyCollectionChanged inc = ientry as INotifyCollectionChanged;
     if (inc != null)
     {
         inc.CollectionChanged += inc_CollectionChanged;
         if (icontainer != null)
             _Mapped.Add(inc, icontainer);
     }
 }
        protected override void OnAttached()
        {
            base.OnAttached();

            multiSelector = AssociatedObject as MultiSelector;

            if (multiSelector == null)
            {
                throw new InvalidOperationException();
            }

            multiSelector.ItemContainerGenerator.StatusChanged += ItemContainerGeneratorOnStatusChanged;
        }
 private void Edit(MultiSelector tempGrid)
 {
     if (tempGrid.SelectedItems != null && tempGrid.SelectedItems.Count == 1)
     {
         var item = tempGrid.SelectedItem as UserCard;
         if (item != null)
         {
     //                    var packDialog = new CardViewTable(item.Id);
     //                    packDialog.Closed += (s, j) => Refresh();
     //                    packDialog.ShowDialog();
         }
     }
 }
Beispiel #5
0
 private void Edit(MultiSelector tempGrid)
 {
     if (tempGrid.SelectedItems != null && tempGrid.SelectedItems.Count == 1)
     {
         var item = tempGrid.SelectedItem as UserCard;
         if (item != null)
         {
             var packDialog = new AddEditCard(item);
             packDialog.Closed += (s, j) => Refresh();
             packDialog.ShowDialog();
         }
     }
 }
Beispiel #6
0
 private static void UpdateSelectedItems(MultiSelector grid)
 {
     var list = GetSelectedItems(grid);
     var i = 0;
     for (; i < grid.SelectedItems.Count; i++)
     {
         var gridItem = grid.SelectedItems[i];
         while (list.Count > i && !AreEqual(gridItem, list[i]))
         {
             list.RemoveAt(i);
         }
         if (list.Count <= i || !AreEqual(gridItem, list[i]))
             list.Insert(i, gridItem);
     }
     while (list.Count > i)
     {
         list.RemoveAt(i);
     }
 }
        private static void Compute_CollectionChanged(MultiSelector lb, IList l, NotifyCollectionChangedEventArgs e)
        {        
            if (l == null)
                return;

            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                lb.SelectedItems.Clear();
                InitCollection(l, lb);
                return;
            }

            if (e.NewItems != null)
            {
                e.NewItems.Cast<object>().Apply(o => lb.SelectedItems.Add(o));
            }

            if (e.OldItems != null)
            {
                e.OldItems.Cast<object>().Apply(o => lb.SelectedItems.Remove(o));
            }
        }
 private static void InitCollection(IList ilis, MultiSelector lb)
 {
     ilis.Cast<object>().Apply(o => lb.SelectedItems.Add(o));
 }
 public MultiSelectorAdapter(MultiSelector multiSelector)
 {
     this.multiSelector = multiSelector;
 }