//private void DelNorightIndex(TopicDragItemInfo index) //{ // topicDragItemList.Remove(topicDragItemList.FirstOrDefault(p => p.Id == index.Id)); // topicDragItemOtherList.Remove(index); // txtNoRightCount.Text = topicDragItemOtherList.Count.ToString(); //} private void addNoright(int count) { for (int i = 0; i < count; i++) { TopicDragItemInfo model = new TopicDragItemInfo() { Id = Guid.NewGuid(), Text = "" }; topicDragItemList.Add(model); topicDragItemOtherList.Add(model); addNoAnswer(topicDragItemOtherList.Count - 1, model); } }
public void SaveTopicDrag() { ObservableCollection <TopicDragItemInfo> topicDragItemListChild = new ObservableCollection <TopicDragItemInfo>(); foreach (var item in topicDragItemAnswerList) { TopicDragItemInfo tdii = new TopicDragItemInfo(); tdii.Id = item.Id; tdii.Text = item.Text; topicDragItemListChild.Add(tdii); } foreach (var item in topicDragItemOtherList) { topicDragItemListChild.Add(item); } topicDragItemList = topicDragItemListChild; }
private void addNoAnswer(int i, TopicDragItemInfo model) { RowDefinition row = new RowDefinition(); //Border b = new Border(); //b.BorderThickness = new Thickness(0, 0, 0, 1); //b.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ffc4c4c4")); //datagrid.Children.Add(b); //Grid.SetRow(b, i); datagrid.RowDefinitions.Add(row); row.Height = new GridLength(0, GridUnitType.Auto); TextBox tt = new TextBox(); tt.Style = FindResource("HelpBrushTextBox") as Style; tt.DataContext = model; tt.Text = tt.Text; tt.TextChanged -= TextBox_TextChanged; tt.TextChanged += TextBox_TextChanged; datagrid.Children.Add(tt); Grid.SetRow(tt, i); }