private void NewTodoBtnClick(object sender, RoutedEventArgs e) { TodoWindow createNewTodoWin = new TodoWindow(null); createNewTodoWin.Closed += TodoWindow_Closed; createNewTodoWin.ShowDialog(); }
private void EditTodo_OnClick(object sender, MouseButtonEventArgs e) { Todo todo = new Todo(); if (sender is ListBox) { ListBox listBox = (ListBox)sender; todo = (Todo)listBox.SelectedItem; } else if (sender is Label) { Label label = (Label)sender; todo = (Todo)label.DataContext; } else { return; } if (todo != null) { TodoWindow createNewTodoWin = new TodoWindow((int)todo.TodoID); createNewTodoWin.Closed += TodoWindow_Closed; createNewTodoWin.ShowDialog(); } }