<kanban:SfKanban.CardTemplate>
<DataTemplate>
<Frame WidthRequest="250" Padding="0" CornerRadius="8" HasShadow="False" >
<StackLayout Padding="10" Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Path=Title}" TextColor="Black" HorizontalOptions="StartAndExpand" >
</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Description}" WidthRequest="150" FontSize="14" TextColor="Silver" LineBreakMode="WordWrap" ></Label>
<Image Source="{Binding ImageURL}" HeightRequest="50" WidthRequest="50" ></Image>
</StackLayout>
</StackLayout>
</Frame>
</DataTemplate>
</kanban:SfKanban.CardTemplate> |
namespace SampleKanban.Droid
{
public class CustomKanbanAdapter : KanbanAdapterHelper
{
public CustomKanbanAdapter(Syncfusion.SfKanban.Android.SfKanban kanban, Syncfusion.SfKanban.XForms.SfKanban fkanban) : base(kanban, fkanban)
{
}
protected override void BindItemView(Native.KanbanColumn column, Native.KanbanItemViewHolder viewHolder, object data, int position)
{
base.BindItemView(column, viewHolder, data, position);
viewHolder.ItemView.SetBackgroundColor(Android.Graphics.Color.Transparent);
}
}
}
} |
. . .
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
. . .
Xamarin.Forms.Forms.ViewInitialized += Forms_ViewInitialized;
. . .
LoadApplication(new App());
}
. . .
private void Forms_ViewInitialized(object sender, ViewInitializedEventArgs e)
{
var nativeKanban = e.NativeView as Native.SfKanban;
var FormsKanban = e.View as SfKanban;
if (nativeKanban != null && FormsKanban != null)
{
nativeKanban.Adapter = new CustomKanbanAdapter(nativeKanban, FormsKanban);
}
} |
Hello! Is it possible to achieve this when using a DataTemplateSelector? Thanks!
Hi Kleverton,
#Regarding DataTemplateSelector in SfKanban
Your requirement can also be achieved using the DataTemplateSelector in SFKanban. Please refer to the following UG documentation about ‘How to use the DataTemplateSelector in SfKanban’ for your reference.
UG: https://help.syncfusion.com/xamarin/kanban-board/cards#data-template-selector
Please let us know if you have any concerns.
Regards,
SaiGanesh Sakthivel