We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Controlling Drag of Cards in a Column

Thread ID:

Created:

Updated:

Platform:

Replies:

147977 Sep 30,2019 02:05 PM UTC Oct 1,2019 02:16 PM UTC WPF 1
loading
Tags: SfKanban
Sheri Steeves
Asked On September 30, 2019 02:40 PM UTC

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


Lakshmi Radha Krishnan [Syncfusion]
Replied On October 1, 2019 02:16 PM UTC

Hi Sheri,

 

Greetings from Syncfusion.

 

Query 1: 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

 

You can achieve this requirement using the AllowDrag property in the KanbanColumn. Please refer the below reference link.

 

Link: https://help.syncfusion.com/wpf/sfkanban/column?cs-save-lang=1&cs-lang=xaml#enabledisable-drag--drop

 

Query 2: I have been trying to cancel the dragging of the other cards above and below the special cards

 

You can restrict the card transition from one column to another column using the Category and AllowTransitions property in the Kanban. Please refer the below reference link.

 

Link: https://help.syncfusion.com/wpf/sfkanban/workflows

 

We have prepared a sample for the above queries, please download it form the following location.

 

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Kanban_WPF-377315559

 

Please let us know if you need further assistance on this.

 

Regards,

Lakshmi R. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon