Exemplo n.º 1
0
        //Them radio button voi noi dung content(la 1 string) vao control.
        public void AddOneSelection(string content)
        {
            RadioButton radioBtn = new RadioButton();

            //gan noi dung cho radioBtn
            radioBtn.Content = string.Copy(content);
            //canh le cho radioBtn
            radioBtn.Margin = new Thickness(10.00, 0.00, 10.00, 0.00);
            //canh cho radioBtn luon o chinh giua row (thoe chieu cao)
            radioBtn.VerticalAlignment = VerticalAlignment.Center;

            //them 1 row danh cho radio button vao Grid
            rowDefCollection.Insert(iNumOption + 2, new RowDefinition());

            //cho Grid biet radioBtn thuoc row nao
            Grid.SetRow(radioBtn, iNumOption + 2);

            //tang so radio button len 1
            ++iNumOption;

            radioBtn.Checked += new RoutedEventHandler(RadioButton_Checked);

            //them radioBtn vao rdlOptions
            rdlOptions.Add(radioBtn);

            //them radioBtn vao LayoutRoot
            LayoutRoot.Children.Add(radioBtn);

            LayoutRoot.UpdateLayout();
        }
Exemplo n.º 2
0
        //Them QuestionControl vao qclItems
        public void AddOneItem(SentenceCorrectionControl item)
        {
            rowDefCollection.Insert(iNumItem + 1, new RowDefinition());

            Grid.SetRow(item, iNumItem + 1);

            item.Margin = new Thickness(10.00, 0.00, 0.00, 0.00);

            item.VerticalAlignment = VerticalAlignment.Center;

            ++iNumItem;

            qclItems.Add(item);

            gridChildLayout.Children.Add(item);
        }
            /// <summary>
            /// Processes the insertion of a new row.
            /// </summary>
            /// <param name="index">The index at which the definition is inserted.</param>
            protected override void InsertItem(int index)
            {
                var newItem = new RowDefinition();

                definitions.Insert(index, newItem);
            }