Creating kanban with button click
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);
}
SIGN IN To post a reply.
1 Reply
RA
Rachel A
Syncfusion Team
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.
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
KI Kirsten
- Dec 12, 2019 04:03 AM UTC
- Dec 13, 2019 01:26 PM UTC