Example #1
0
        /// <summary>
        /// Moves the column of this.ColumnDefinition in the direction given as parameter.
        /// </summary>
        /// <param name="moveDirection">The direction in which to move the column.</param>
        /// <returns>True if the columns was moved successfully, false otherwise (if the column was already all the way in the direction we tried to move it).</returns>
        bool MoveColumn(MoveDirection moveDirection)
        {
            KanBanControl kanBanControl = ColumnDefinition._kanBanControl;
            var           columns       = kanBanControl.Columns;
            //Get the current index of the column to move:
            int index = columns.IndexOf(this.ColumnDefinition);

            //Make sure we do not try to move the column outside of the possible range:
            if ((int)moveDirection == -1)
            {
                if (index == 0)
                {
                    return(false);
                }
            }
            else
            {
                if (index == columns.Count - 1)
                {
                    return(false);
                }
            }
            //Move the column:
            columns.RemoveAt(index);
            columns.Insert(index + (int)moveDirection, ColumnDefinition);
            //Force a refresh:
            ColumnDefinition._kanBanControl.Columns = null;
            ColumnDefinition._kanBanControl.Columns = columns;
            return(true);
        }
Example #2
0
        private static void OnColumns_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            KanBanControl kanBanControl = (KanBanControl)d;

            if (kanBanControl._kanBanViewModel != null) //I think we can remove this test since kanBanControl._kanBanViewModel is set in the constructor of KanBanControl
            {
                kanBanControl.HandleColumnsOrItemsSourceChanged();

                if (e.OldValue is ObservableCollection <KanBanColumn> )
                {
                    ((ObservableCollection <KanBanColumn>)e.OldValue).CollectionChanged -= kanBanControl.KanBanControl_ColumnsChanged;
                }
                if (kanBanControl.Columns is ObservableCollection <KanBanColumn> )
                {
                    ((ObservableCollection <KanBanColumn>)kanBanControl.Columns).CollectionChanged -= kanBanControl.KanBanControl_ColumnsChanged;
                    ((ObservableCollection <KanBanColumn>)kanBanControl.Columns).CollectionChanged += kanBanControl.KanBanControl_ColumnsChanged;
                }

                //IEnumerable<KanBanColumn> columns = (IEnumerable<KanBanColumn>)e.NewValue;
                //List<ColumnViewModel> columnViewModels = new List<ColumnViewModel>();
                //foreach (KanBanColumn column in columns)
                //{
                //    columnViewModels.Add(new ColumnViewModel(column, kanBanControl.ItemTemplate));
                //}
                ////todo: add a column for unclassified elements

                //kanBanControl._kanBanViewModel.Columns = columnViewModels;
                //kanBanControl.SetItemsInViewModelColumns(columnViewModels);
            }
        }
Example #3
0
        private static void ItemsSource_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //todo.
            //do nothing for now, redraw when supported.
            KanBanControl kanBanControl = (KanBanControl)d;

            kanBanControl.HandleColumnsOrItemsSourceChanged();
        }
Example #4
0
        private static void ItemTemplate_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //we force a Refresh:
            KanBanControl kanBanControl = (KanBanControl)d;
            var           columns       = kanBanControl.Columns;

            kanBanControl.Columns = null;
            kanBanControl.Columns = columns;
        }
        public void Execute(object parameter)
        {
            KanBanControl kanBanControl = _item._kanBanControl;

            kanBanControl.OnItemClicked(_item, parameter);
        }
 internal ShowAddColumnChildWindowCommand(KanBanControl kanBanControl)
 {
     _kanBanControl = kanBanControl;
 }
 internal KanBanViewModel(KanBanControl kanBanControl)
 {
     _kanBanControl = kanBanControl;
     ShowAddColumnChildWindow_Command = new ShowAddColumnChildWindowCommand(_kanBanControl);
 }
Example #8
0
 public ItemViewModel(object item, KanBanControl kanBanControl)
 {
     Item                = item;
     _kanBanControl      = kanBanControl;
     ItemClicked_Command = new ItemClickedCommand(this);
 }