After trying the First Look exemple code, there is something I did not find.
If we want to store the control content to a database or any data storage, we can look at the DataContext.Data to get back all the cards.
State property is well corresponding to the new column for exemple.
But how to know in which orders they are now sorted. There is no "Order" / "Index" / "Position" property we can bind ?
Without this info it is difficult to redraw later the same board in the same state.
Is there a way to get this information
Thanks
4 Answers, 1 is accepted
Hi Patrick,
Thank you for the provide details.
You are right that there isn't an easy way to get the card's order inside the column. You could achieve this behavior using custom code. May I ask you to share more information about your set-up of the RadTaskBoard control? Are the columns auto-generated or declared in XAML? Is the cards drag-drop behavior allow in your application? This way, I could try to think of a solution that will fit in your scenario.
Also, providing such property will be a good improvement to the control. That is why I have logged a Feature Request in our Feedback Portal, where you can track its progress and vote for its implementation. Your Telerik Points are updated for the provided feedback.
Regards,
Dinko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products, quickly just got a fresh new look + new and improved content, including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Dinko.
Thanks for your answer. I did not upload code because I use exactly the same code than the "First Look exemple" provided in the WPF Controls Example provided by Telerik.
So columns are still AutoGenerateColumns="False" and defined to :
<telerik:RadTaskBoard.Columns>
<telerik:TaskBoardColumn GroupName="Not Started" Header="NOT STARTED" />
<telerik:TaskBoardColumn GroupName="In Progress" Header="IN PROGRESS" />
<telerik:TaskBoardColumn GroupName="Ready For Test" Header="READY FOR TEST" />
<telerik:TaskBoardColumn GroupName="Done" Header="DONE" />
</telerik:RadTaskBoard.Columns>
I just added a command in the view model (bound to a button).
public DelegateCommand SaveEditCommand { get; set; }
public void SaveEdit()
{
// here I can read back the data
var testing = this.Data.ToList(); // the ObservableCollection<TaskBoardCardModel> collection
// but the items order in the collection doesn't match reality after drag&drops
// and there is no property on this.Data items to read a (int)Order property
}
If you can help me, just take the First look exemple. And thank you, it can help a lot :)
Hello Patrick,
Thank you for the details.
I have created a sample project which demonstrates a possible approach to know the element index in the column. In a few words, I have created a class which derives from TaskBoardCardModel and expose Index property. This property will represent the index of the item inside its column collection. Initially, this index is set inside the Loaded event of the control. So far, so good. Now the tricky part is to change this index when the drag-drop operation is performed. You can extend the CustomTaskBoardDragDropBehavior class from the First Look demo. You can override the Drop and DragDropCompleted methods. Inside the methods, you can set the new index of the source and target collection.
You can find the project attached to this reply. At the top of the window, you can see a button bound to a command from the MainViewModel class. Inside the command executed method, you can iterate the Data collection and get the order of the items by their group.
I hope this project is helpful.
Regards,
Dinko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.