Пример #1
0
        //private void DelrightIndex(TopicDragItemAnswerInfo index)
        //{
        //    topicDragItemList.Remove(topicDragItemList.FirstOrDefault(p => p.Id == index.Id));
        //    topicDragItemAnswerList.Remove(index);
        //    txtCount.Text = topicDragItemAnswerList.Count.ToString();

        //}

        private void addright(int count)
        {
            for (int i = 0; i < count; i++)
            {
                topicDragItemList.Add(new TopicDragItemInfo()
                {
                    Id = Guid.NewGuid(), Text = ""
                });
                TopicDragItemAnswerInfo model = new TopicDragItemAnswerInfo()
                {
                    Id          = topicDragItemList[topicDragItemList.Count - 1].Id,
                    TopicDrag   = topicDragItemList[topicDragItemList.Count - 1],
                    AnswerId    = Guid.NewGuid(),
                    AnswerPoint = new Point(140, 10 + (topicDragItemAnswerList.Count + 1) * 33),
                    QuestionId  = Guid.NewGuid(), QuestionPoint = new Point(300, 10 + (topicDragItemAnswerList.Count + 1) * 33)
                };
                topicDragItemAnswerList.Add(model);
                addAnswer(topicDragItemAnswerList.Count - 1, model);
            }
        }
Пример #2
0
        private void addAnswer(int i, TopicDragItemAnswerInfo 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"));
            //datagridRight.Children.Add(b);

            //Grid.SetRow(b, i);

            datagridRight.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;
            datagridRight.Children.Add(tt);
            Grid.SetRow(tt, i);
        }