Exemplo n.º 1
0
 internal OpenContextMenuColumnModificationCommand(ColumnViewModel column)
 {
     _column = column;
 }
Exemplo n.º 2
0
 internal ShowMoreCommand(ColumnViewModel column)
 {
     _column = column;
 }
Exemplo n.º 3
0
        void SetItemsInViewModelColumns(ObservableCollection <ColumnViewModel> columns)
        {
            Dictionary <object, ColumnViewModel> quickColumnsFromId      = new Dictionary <object, ColumnViewModel>();
            Dictionary <object, IEnumerable <ItemViewModel> > listFromId = new Dictionary <object, IEnumerable <ItemViewModel> >();
            ObservableCollection <ItemViewModel> remainingItems          = new ObservableCollection <ItemViewModel>();
            ColumnViewModel unclassifiedColumn = null;

            foreach (ColumnViewModel column in columns)
            {
                column.UnalteredItemsCollection.Clear();
                if (column.ColumnDefinition.Id != null)
                {
                    quickColumnsFromId.Add(column.ColumnDefinition.Id, column);
                    listFromId.Add(column.ColumnDefinition.Id, new ObservableCollection <ItemViewModel>());
                }
                else
                {
                    unclassifiedColumn = column;
                    unclassifiedColumn.IsUnclassifiedColumn = true;
                }
            }
            if (ItemsSource != null)
            {
                foreach (Object item in ItemsSource)
                {
                    //Get the id from the item and add a Binding to it so we can update it when necessary:
                    object        id;
                    ItemViewModel itemViewModel = new ItemViewModel(item, this);
                    Binding       binding       = new Binding(ColumnMemberPath);
                    binding.Source = item;
                    binding.Mode   = BindingMode.TwoWay;
                    BindingOperations.SetBinding(itemViewModel, ItemViewModel.ItemColumnIdProperty, binding);
                    //itemViewModel.SetBinding(ItemViewModel.ItemColumnIdProperty, binding);
                    id = itemViewModel.ItemColumnId;
                    //todo: handle the case where the Binding is broken.

                    //Add a binging to get the ItemOrder:
                    Binding orderBinding = new Binding(OrderMemberPath);
                    orderBinding.Source = item;
                    orderBinding.Mode   = BindingMode.TwoWay;
                    BindingOperations.SetBinding(itemViewModel, ItemViewModel.ItemOrderProperty, orderBinding);
                    //itemViewModel.SetBinding(ItemViewModel.ItemOrderProperty, orderBinding);

                    //Add the item to the list for the corresponding id:
                    if (id != null && listFromId.ContainsKey(id))
                    {
                        ((ObservableCollection <ItemViewModel>)listFromId[id]).Add(itemViewModel);
                    }
                    else
                    {
                        remainingItems.Add(itemViewModel);
                    }
                }

                foreach (object id in listFromId.Keys)
                {
                    quickColumnsFromId[id].UnalteredItemsCollection = (ObservableCollection <ItemViewModel>)listFromId[id];
                }

                if (unclassifiedColumn != null)
                {
                    //we should always enter this "if"
                    unclassifiedColumn.UnalteredItemsCollection = remainingItems;
                }
            }
        }
Exemplo n.º 4
0
 internal ItemDropCommand(ColumnViewModel column)
 {
     _column = column;
 }