We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

move card to different column from code

How to move card to a different column from c#?

1 Reply

BK Bharathiraja K Syncfusion Team April 17, 2019 08:44 AM UTC

Hi Artur, 
 
Greetings from Syncfusion. We can move the card to a different column by changing its category dynamically in C#. Please find the code sample. 
 
Code Snippet [XAML]: 
 
<Button Text="Move Card" Clicked="MoveCard_Clicked"/> 
 
        <kanban:SfKanban x:Name="kanban" AutoGenerateColumns="False" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" ItemsSource="{Binding Cards}"> 
 
        <kanban:SfKanban.BindingContext> 
                <local:ViewModel x:Name="viewModel"/> 
            </kanban:SfKanban.BindingContext> 
             
        <kanban:SfKanban.Columns> 
 
            <kanban:KanbanColumn x:Name="column1" Title="To Do"> 
            </kanban:KanbanColumn> 
 
            <kanban:KanbanColumn x:Name="column2" Title="In Progress"> 
            </kanban:KanbanColumn> 
 
            <kanban:KanbanColumn x:Name="column3" Title="Code Review"> 
            </kanban:KanbanColumn> 
 
            <kanban:KanbanColumn x:Name="column4" Title="Done"> 
            </kanban:KanbanColumn> 
 
        </kanban:SfKanban.Columns> 
 
    </kanban:SfKanban> 
 
 
 
C#: 
private void MoveCard_Clicked(object sender, EventArgs e) 
        { 
            var category = viewModel.Cards[0].Category; 
 
            if (category.ToString() == "Open") 
            { 
                viewModel.Cards[0].Category = "In Progress"; 
            } 
            else if (category.ToString() == "In Progress") 
            { 
                viewModel.Cards[0].Category = "Code Review"; 
            } 
            else if (category.ToString() == "Code Review") 
            { 
                viewModel.Cards[0].Category = "Closed"; 
            } 
        } 
 
 
Please find the sample link: 
 
Can you please revert us if your requirement differs from this? It will be helpful for us to investigate further and provide you a better solution at the earliest. 
 
Regards, 
Bharathi. 


Loader.
Live Chat Icon For mobile
Up arrow icon