How to extend default KanbanModel and retrieve on ItemTap?

Hi,
 I tried like below adding a Key field (as Id is double but i need as string)

 public class WorkoutKanbanModel : KanbanModel
    {
        public string Key { get; set; }         
    }

then I created a CardTemplate as below, but I am not able to bind Key property, it doesnt display and also i want to retrieve the same property on ItemTapped event. is it possible?

     <kanban:SfKanban AutoGenerateColumns="False"  HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"  
               ItemTapped="SfKanban_ItemTapped" DragEnd="Kanban_DragEnd"  Columns="{Binding KanbanColumns}" ItemsSource="{Binding KanbanModels}">
            
            <kanban:SfKanban.CardTemplate>
                <DataTemplate>
                    <StackLayout>
                        <Grid ColumnSpacing="0" HorizontalOptions="FillAndExpand" Padding="10" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="80" />
                            </Grid.ColumnDefinitions>

                            <StackLayout Grid.Column="0"  Orientation="Vertical" >
                                 
                                <Label FontSize="Small" Text="{Binding Path=Key}" TextColor="Black" IsVisible="True"/>
                                
                                <Label Text="{Binding Path=Title}" />
                                <Label FontSize="Small" Text="{Binding Path=Description}" WidthRequest="150" TextColor="Silver" LineBreakMode="WordWrap" />
                            </StackLayout>

                            <StackLayout Grid.Column="1" >
                                <Image WidthRequest="60" HeightRequest="60" HorizontalOptions="End" VerticalOptions="CenterAndExpand" Source="{Binding Path=ImageURL}"></Image>
                            </StackLayout>
                        </Grid>

                    </StackLayout>

                </DataTemplate>
            </kanban:SfKanban.CardTemplate>
        </kanban:SfKanban>


Last thing, Is it possible that you can share your default CardTemplate for SfKanban, I really like it and I want my custom CardTemplate to be similar to it. 

thanks,

Emil

2 Replies

EM Emil November 23, 2017 04:04 PM UTC

can you provide me a help for this if possible please?


SJ Sumathi Jayaraj Syncfusion Team November 28, 2017 05:52 AM UTC

Hi Emil,   
   
Thanks for contacting Syncfusion Support.   
   
Query 1: How to retrieve the Key property value in ItemTapped?   
   
We can achieve your requirement by using Data property in the KanbanTappedEventArgs event arguments as shown in the below code.  
 
 
[C#]   
   
private void SfKanban_ItemTapped(object sender, KanbanTappedEventArgs e)   
{   
       WorkoutKanbanModel data = e.Data as WorkoutKanbanModel;   
       string key = data.Key;   
}   
  
Query 2: Not able to bind the Key property in the CardTemplate.   
   
We are unable to reproduce the reported problem from our side. Please find the demo sample from the following location. If still problem persists please reproduce the issue in the provided demo sample.    
   
Sample:  Kanban_Demo  
   
Query 3: Need default card template view.   
 
We rendered the Kanban in each native platforms internally, so the default card template varies in Xamarin Forms based on the platform. Please find the following reference links to achieve the default card view. 
 
 
Regards,   
Sumathi J 


Loader.
Up arrow icon