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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Creating kanban with button click

Thread ID:

Created:

Updated:

Platform:

Replies:

149861 Dec 12,2019 04:03 AM UTC Dec 13,2019 01:26 PM UTC WPF 1
loading
Tags: SfKanban
Kirsten
Asked On December 12, 2019 04:03 AM UTC

Hey to give a run down of what im trying to achieve is on launch of my WPF application I have it so you can create a project. Options include project name, project description ect. Kanban control is the best to show case the projects but my issue is I cant get it to create one off a button click. Code is provided below of how I tried to Achieve this and any help is appreciated

private void createprojectButton_Click(object sender, RoutedEventArgs e)
        {
            if (projectNameTxt.Text.Length > 1)
            {
                MessageBox.Show("test");
                taskDetails.CreateTask(projectNameTxt.Text, "3", "Description", "Project", "High", new string[] { "BO2", "MP" }, "Images/Image0.png");
            }
            
            
        }
    }




    public class TaskDetails
    {
        
        public TaskDetails()
        {
            Tasks = new ObservableCollection<KanbanModel>();
            
            KanbanModel task = new KanbanModel();
            task.Title = "test";
            task.ID = "1";
            task.Description = "Project Name -";
            task.Category = "Project";
            task.ColorKey = "High";
            task.Tags = new string[] { "BO2" , "MP" };
            task.ImageURL = new Uri(@"Images/Image0.png", UriKind.RelativeOrAbsolute);
            Tasks.Add(task);


        }
        public ObservableCollection<KanbanModel> Tasks { get; set; }

        public void CreateTask(string title, string id, string desc, string category, string color, string[] tags, string imgUrl)
        {

            Tasks = new ObservableCollection<KanbanModel>();


            KanbanModel task = new KanbanModel();

            task.Title = title;

            task.ID = id;

            task.Description = desc;

            task.Category = category;

            task.ColorKey = color;

            task.Tags = tags;

            task.ImageURL = new Uri($"{imgUrl}", UriKind.RelativeOrAbsolute);

            Tasks.Add(task);
            
        }



Rachel A [Syncfusion]
Replied On December 13, 2019 01:26 PM UTC

Hi Kirsten, 
  
Greetings from Syncfusion. 
  
We have created a sample for adding a new task to the KanbanColumn from button click. We have attached sample for your reference and download it form the following location. 
 
Code Snippet: 
 
  
  
public class TaskDetails 
 { 
        public TaskDetails() 
        { 
            Tasks = new ObservableCollection<KanbanModel>(); 
  
            KanbanModel task = new KanbanModel(); 
            task.Title = "test"; 
            task.ID = "1"; 
            task.Description = "Project Name -"; 
            task.Category = "Project"; 
            task.ColorKey = "High"; 
            task.Tags = new string[] { "BO2", "MP" }; 
            Tasks.Add(task); 
        } 
  
        public ObservableCollection<KanbanModel> Tasks { get; set; } 
  
        public void CreateTask(string title, string id, string desc, string category, string color, string[] tags) 
        { 
            KanbanModel task = new KanbanModel(); 
            task.Title = title; 
            task.ID = id; 
            task.Description = desc; 
            task.Category = category; 
            task.ColorKey = color; 
            task.Tags = tags; 
            Tasks.Add(task); 
        } 
    } 
  
  
  
public partial class MainWindow : Window 
{ 
        public MainWindow() 
        { 
            InitializeComponent(); 
        } 
  
        private void CreateprojectButton_Click(object sender, RoutedEventArgs e) 
        { 
            MessageBox.Show("test"); 
            taskDetails.CreateTask("test1", "3", "Description", "Project", "High", new string[] { "BO2", "MP" }); 
        } 
 } 
  
  
  
Sample: 
  
Please let us know if you need further assistance on this. 
 
Thanks, 
Rachel. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon