private void lstTask_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lstTask.SelectedIndex == -1) { return; } txtDesc.Document.Blocks.Clear(); txtRemark.Document.Blocks.Clear(); Task task = (Task)lstTask.SelectedItem; txtTaskName.Text = task.TaskName; txtDesc.AppendText(task.TaskDesc); dtpDueDate.SelectedDateTime = task.DueDate; TasksHelper client = new TasksHelper(); TaskAssignment assn = client.GetTaskAssignment(task.TaskID, event_.EventID, int.Parse(cboRole.SelectedValue.ToString())); txtRemark.AppendText(assn.Remarks); chkIsCompleted.IsChecked = this.txtRemark.IsReadOnly = assn.IsCompleted; chkIsCompleted.IsEnabled = !assn.IsCompleted; if (!assn.IsRead) { client.SetTaskRead(task, int.Parse(cboRole.SelectedValue.ToString())); } client.Close(); }