Hi bala ilango,
Greetings from Syncfusion.
We would like to let you know that header template has data context of ColumnTag. It has only listed properties as per in the UG section. But we achieved it by passing the entire data context that is ColumnTag and itself has private field name of Column (it has entire cards collection as per the category).
To achieve it, we have to add custom KanbanModel with including the EstimatedTime property to hold the int value. As per below code snippet with usage of converter, we can get the total count of estimated time of corresponding category,
|
public class EstimatedCalConveter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var dataContext = (value as ColumnTag);
var total = 0;
if (dataContext != null)
{
PropertyInfo ColumnGetter = dataContext.GetType().GetProperty("Column", BindingFlags.NonPublic | BindingFlags.Instance);
KanbanColumn kanbanColumn = (KanbanColumn)ColumnGetter.GetValue(dataContext);
foreach(var KanbanCardItem in kanbanColumn.Cards)
{
total = total + (KanbanCardItem.Content as CustomKanbanModel).EstimatedTime;
}
}
return "Estimated Time: " + total + " mins";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
} |
|
<syncfusion:SfKanban.ColumnHeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" >
<TextBlock Text="{Binding Header}" Margin="0,0,0,3" />
<TextBlock Text="{Binding Converter={StaticResource EstimatedCalConveter}}"/>
</StackPanel>
</DataTemplate>
</syncfusion:SfKanban.ColumnHeaderTemplate> |
Output:
Regards,
Hemalatha M.