Catch a card being dropped into a new swimlane using MVVM
Hi
I'm batting to find how to catch the drop of a card into a new swimlane.
Each of my categories needs to log the datetime of when it was moved into a different swimlane as that will trigger certain processes.
I thought maybe CardTappedCommand would get things going but that just tells me when a card was clicked on.
Any help would be appreciated.
Kr
George
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
DD
Devakumar Dhanapoosanam
Syncfusion Team
June 6, 2021 10:22 AM UTC
Hi George Bamber,
Greetings from Syncfusion.
We have analyzed your query and we have achieved your requirement “Catch a card being dropped into a new swimlane using MVVM” by binding the Kanban CardDragEnd event in MVVM by using the below code,
|
<kanban:SfKanban x:Name="kanban"
ItemsSource="{Binding Tasks}" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="CardDragEnd">
<i:InvokeCommandAction Command="{Binding CardDragEnd}" CommandParameter="{Binding ElementName=kanban}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</kanban:SfKanban> |
SwimlaneViewModel.cs
|
public class SwimlaneViewModel : INotifyPropertyChanged
{
…
private ICommand cardDragEnd;
public ICommand CardDragEnd
{
get
{
return cardDragEnd ?? (cardDragEnd = new RelayCommand(CanExecute));
}
}
private bool canExecute;
public void CanExecute(object parameter)
{
SfKanban sfKanban = parameter as SfKanban;
PropertyInfo property = null;
if (sfKanban != null)
{
property = sfKanban.GetType().GetProperty("SelectedCard", BindingFlags.Instance | BindingFlags.NonPublic);
}
KanbanCardItem kanbanCardItem = null;
if (property != null)
{
kanbanCardItem = (KanbanCardItem)property.GetValue(sfKanban);
}
KanbanModel selectedCardContent = null;
if (kanbanCardItem != null)
{
selectedCardContent = kanbanCardItem.Content as KanbanModel;
}
if (selectedCardContent != null)
{
MessageBox.Show("Card Title:" + selectedCardContent.Title);
}
}
…
} |
We have prepared a sample based on your requirement. Please find the sample from the below link,
Please let us know if you need any further assistance on this.
Regards,
Devakumar D
Marked as answer
GB
George Bamber
June 6, 2021 10:43 AM UTC
Hi Devakumar
That is exactly what I needed.
I hope this helps anyone else who wants to do what I'm doing.
Thanks you very much for your assistance.
Kind regards
George
DD
Devakumar Dhanapoosanam
Syncfusion Team
June 7, 2021 05:47 AM UTC
Hi George Bamber,
Thanks for the update.
We are glad that the given solution has helped to achieve your requirement. Please let us know if you need further assistance on this.
Regards,
Devakumar D
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
GB George Bamber
- Jun 3, 2021 12:33 PM UTC
- Jun 7, 2021 05:47 AM UTC