Skip to content

Commit 440ebf9

Browse files
Merge pull request #3869 from syncfusion-content/997111-Kanban-KeepCard
997111 - Prepared UG content for Kanban KeepCard support
2 parents 0353e44 + fe88303 commit 440ebf9

File tree

1 file changed

+105
-1
lines changed

1 file changed

+105
-1
lines changed

MAUI/Kanban-Board/Events.md

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,111 @@ public class KanbanViewModel
146146
* [`Cancel`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.KanbanDragStartEventArgs.html#Syncfusion_Maui_Kanban_KanbanDragStartEventArgs_Cancel) - Used to cancel the drag action.
147147
* [`Data`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.KanbanDragEventArgs.html#Syncfusion_Maui_Kanban_KanbanDragEventArgs_Data) - Used to get the underlying model of the card.
148148
* [`SourceColumn`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.KanbanDragEventArgs.html#Syncfusion_Maui_Kanban_KanbanDragEventArgs_SourceColumn) - Used to get the source column of card.
149-
* [`SourceIndex`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.KanbanDragEventArgs.html#Syncfusion_Maui_Kanban_KanbanDragEventArgs_SourceIndex) - Used to get the index of the card in source column.
149+
* [`SourceIndex`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.KanbanDragEventArgs.html#Syncfusion_Maui_Kanban_KanbanDragEventArgs_SourceIndex) - Used to get the index of the card in source column.
150+
* `KeepCard` - Determines whether the original card remains in the source column during a drag operation. When set to `true`, the card stays in its original column while being dragged, allowing repeated drag-and-drop actions without relocating the card. A preview of the card is generated during the drag.
151+
152+
{% tabs %}
153+
{% highlight XAML hl_lines="3" %}
154+
155+
<kanban:SfKanban x:Name="kanban"
156+
ItemsSource="{Binding TaskDetails}"
157+
DragStart="OnKanbanCardDragStart">
158+
<kanban:SfKanban.BindingContext>
159+
<local:ViewModel/>
160+
</kanban:SfKanban.BindingContext>
161+
</kanban:SfKanban>
162+
163+
{% endhighlight %}
164+
{% highlight C# hl_lines="2 6" %}
165+
166+
this.kanban.ItemsSource = new ViewModel().TaskDetails;
167+
this.kanban.DragStart += OnKanbanCardDragStart;
168+
169+
private void OnKanbanCardDragStart(object sender, KanbanDragStartEventArgs e)
170+
{
171+
e.KeepCard = true;
172+
}
173+
174+
{% endhighlight %}
175+
{% highlight c# tabtitle="ViewModel.cs" %}
176+
177+
public class ViewModel
178+
{
179+
#region Properties
180+
181+
/// <summary>
182+
/// Gets or sets the collection of <see cref="KanbanModel"/> objects representing tasks in various stages.
183+
/// </summary>
184+
public ObservableCollection<KanbanModel> TaskDetails { get; set; }
185+
186+
#endregion
187+
188+
#region Constructor
189+
190+
/// <summary>
191+
/// Initializes a new instance of the <see cref="ViewModel"/> class.
192+
/// </summary>
193+
public ViewModel()
194+
{
195+
this.TaskDetails = this.GetTaskDetails();
196+
}
197+
198+
#endregion
199+
200+
#region Private methods
201+
202+
/// <summary>
203+
/// Method to get the kanban model collections.
204+
/// </summary>
205+
/// <returns>The kanban model collections.</returns>
206+
private ObservableCollection<KanbanModel> GetTaskDetails()
207+
{
208+
var taskDetails = new ObservableCollection<KanbanModel>();
209+
210+
KanbanModel taskDetail = new KanbanModel();
211+
taskDetail.Title = "UWP Issue";
212+
taskDetail.ID = 7;
213+
taskDetail.Description = "Crosshair label template not visible in UWP";
214+
taskDetail.Category = "Open";
215+
taskDetail.IndicatorFill = Colors.Blue;
216+
taskDetail.Tags = new List<string>() { "Bug Fixing" };
217+
taskDetails.Add(taskDetail);
218+
219+
taskDetail = new KanbanModel();
220+
taskDetail.Title = "WinUI Issue";
221+
taskDetail.ID = 8;
222+
taskDetail.Description = "AxisLabel cropped when rotating the axis label";
223+
taskDetail.Category = "Open";
224+
taskDetail.IndicatorFill = Colors.Pink;
225+
taskDetail.Tags = new List<string>() { "Bug Fixing" };
226+
taskDetails.Add(taskDetail);
227+
228+
taskDetail = new KanbanModel();
229+
taskDetail.Title = "Kanban Feature";
230+
taskDetail.ID = 9;
231+
taskDetail.Description = "Provide drag and drop support";
232+
taskDetail.Category = "In Progress";
233+
taskDetail.IndicatorFill = Colors.Yellow;
234+
taskDetail.Tags = new List<string>() { "New control" };
235+
taskDetails.Add(taskDetail);
236+
237+
taskDetail = new KanbanModel();
238+
taskDetail.Title = "New Feature";
239+
taskDetail.ID = 10;
240+
taskDetail.Description = "Dragging events support for Kanban";
241+
taskDetail.Category = "Closed";
242+
taskDetail.IndicatorFill = Colors.Orange;
243+
taskDetail.Tags = new List<string>() { "New Control" };
244+
taskDetails.Add(taskDetail);
245+
246+
return taskDetails;
247+
}
248+
249+
#endregion
250+
}
251+
252+
{% endhighlight %}
253+
{% endtabs %}
150254

151255
## DragEnd
152256

0 commit comments

Comments
 (0)