Hi,
I'm working on an application that uses the TaskBoard and have encountered an issue when updating the State property of the TaskBoardCardModel. When the State is updated via binding should the card not move to the appropriate column?
To reproduce the issue I've provided the XAML and view model code for your review.
<
Window
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local
=
"clr-namespace:TaskBoardIssue"
x:Class
=
"TaskBoardIssue.MainWindow"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
WindowState
=
"Maximized"
>
<
Window.DataContext
>
<
local:TaskBoardVM
/>
</
Window.DataContext
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"5*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
StackPanel
Grid.Column
=
"1"
Orientation
=
"Vertical"
>
<
Button
Content
=
"Add New Model"
Margin
=
"3"
Command
=
"{Binding AddModel}"
/>
<
Button
Content
=
"Update State"
Margin
=
"3"
Command
=
"{Binding UpdateModel}"
/>
<
telerik:RadPropertyGrid
Item
=
"{Binding TestModel}"
/>
</
StackPanel
>
<
telerik:RadTaskBoard
ItemsSource
=
"{Binding MyTasks}"
GroupMemberPath
=
"State"
AutoGenerateColumns
=
"True"
/>
</
Grid
>
</
Window
>
using
System;
using
System.Collections.Generic;
using
System.Collections.ObjectModel;
using
System.ComponentModel;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Input;
using
Telerik.Windows.Controls;
using
Telerik.Windows.Controls.TaskBoard;
namespace
TaskBoardIssue
{
public
class
TaskBoardVM : INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler PropertyChanged;
ObservableCollection<TaskBoardCardModel> myTasks;
public
ObservableCollection<TaskBoardCardModel> MyTasks {
get
;
set
; }
private
TaskBoardCardModel testModel;
public
TaskBoardCardModel TestModel
{
get
{
return
testModel; }
set
{
if
(testModel !=
null
)
if
(testModel.Equals(value))
return
;
testModel = value;
this
.PropertyChanged?.Invoke(
this
,
new
PropertyChangedEventArgs(nameof(TestModel)));
}
}
public
TaskBoardVM()
{
TestModel =
new
TaskBoardCardModel() { Assignee =
"Alpha"
, Title =
"Title Text"
, Description =
"Description Text"
, State =
"Backlog"
};
MyTasks =
new
ObservableCollection<TaskBoardCardModel>()
{
new
TaskBoardCardModel(){ Assignee =
"Alpha"
, Title =
"Title Text"
, Description =
"Description Text"
, State =
"Backlog"
},
new
TaskBoardCardModel(){ Assignee =
"Alpha"
, Title =
"Title Text"
, Description =
"Description Text"
, State =
"Active"
},
new
TaskBoardCardModel(){ Assignee =
"Alpha"
, Title =
"Title Text"
, Description =
"Description Text"
, State =
"Complete"
},
};
AddModel =
new
DelegateCommand(InsertTestModel, canBeExecuted);
UpdateModel =
new
DelegateCommand(UpdateTestModel, canBeExecuted);
this
.CanExecuteCommand =
true
;
}
public
bool
CanExecuteCommand {
get
;
set
; }
public
ICommand AddModel {
get
;
set
; }
public
ICommand UpdateModel {
get
;
set
; }
private
bool
canBeExecuted(
object
obj)
{
return
this
.CanExecuteCommand;
}
private
void
InsertTestModel(
object
obj)
{
MyTasks.Add(TestModel);
this
.PropertyChanged(
this
,
new
PropertyChangedEventArgs(nameof(MyTasks)));
}
private
void
UpdateTestModel(
object
arg)
{
TestModel.State =
"Active"
;
}
}
}
If you build and run the application, click the 'Add New Model' and you can see the model being added to the appropriate column. However when you click 'Update Model' you can see the State property does update (see Property Grid), but the Task Card does not move to the correct column.
Regards,