Hello,
I am trying to use the Kanban control in a slightly different way.
I need to display list a group of objects as cards into two columns. I have that part working.
My data object is a custom IKanBan model object and the datasource is an ObservableCollection.
In my first column, I have two cards (the first one and the very last one) which are special and I don't want to be able to move them, nor can any of the other cards be moved above or below these special cards.
I was able to block the special cards from from dragging using the CardDragStart event.
I have been trying to cancel the dragging of the other cards above and below the special cards (basically within the same column) using the CardDragEnd event with no success. If I cancel the DragCardEnd event, the card is still visually moved. Also, this is set up as MVVM so I cannot access the kanban control directly though the code.
Here is my event:
private void CardDragEnd(Syncfusion.UI.Xaml.Kanban.KanbanDragEndEventArgs e)
{
// Auto objects cannot be moved to another column --this part works!!
if (e.TargetColumnIndex != e.SelectedColumnIndex &&
(e.SelectedCard.Content as FileNamingPartKanBanModel).DataObject.IncludePart == PrinterUIInfrastructure.Enums.PNFileNamingPartIncludeWhenEnum.Auto)
{
Debug.WriteLine("CARD DRAG END CANCEL CROSSING COLUMNS");
e.IsCancel = true;
return;
}
// First, last objects must stay first and last -- this part doesn't cancel the drag!
if ( (e.SelectedColumnIndex == 0 && e.TargetColumnIndex == 0)
&& e.TargetCardIndex == 0)
{
Debug.WriteLine("CARD DRAG END CANCEL SAME COLUMNN");
e.IsCancel = true;
return;
}
}
Thanks,
Sheri