|
public class CustomModel : IKanbanModel
{
..
/// <summary>
/// Gets or sets the Index.
/// </summary>
public int Index
{
get
{
return this.index;
}
set
{
this.index = value;
this.NotifyPropertyChanged();
}
}
..
}
}
}
private void Kanban_CardDragEnd(object sender, KanbanDragEndEventArgs e)
{
int index = 0;
CustomModel customModel;
foreach (KanbanCardItem cardItem in e.SelectedColumn.Cards)
{
customModel = cardItem.Content as CustomModel;
if (customModel != null)
{
customModel.Index = index;
index++;
}
}
index = 0;
foreach (KanbanCardItem cardItem in e.TargetColumn.Cards)
{
customModel = cardItem.Content as CustomModel;
if (customModel != null)
{
if (index == e.TargetCardIndex)
{
index++;
}
customModel.Index = index;
index++;
}
else
{
(e.SelectedCard.Content as CustomModel).Index = e.TargetCardIndex;
}
}
} |
|
<Grid.Resources>
<DataTemplate x:Key="CardTemplate">
..
<StackPanel Orientation="Horizontal">
<!--Bound the index value-->
<TextBlock Text="{Binding Index}" Margin="5" FontWeight="SemiBold"
FontSize="16"/>
..
</DataTemplate>
</Grid.Resources> |