Пример #1
0
        /// <summary>
        ///
        /// </summary>
        private void BuildRadioButtonCellGroup1()
        {
            // We start by creating a RadioButtonGroupController for the group.
            // This controller gets passed to each radio button cell's constructor
            // where 'group registration' takes place.
            // The RadioButtonGroupController class is the glue' that holds a radio
            // button group together and makes sure that only one radio button cell
            // is ever checked. We must construct a single RadioButtonGroupController
            // for each group of radio buttons in a grid.
            SourceGrid.Cells.Controllers.RadioButtonGroupController group = new SourceGrid.Cells.Controllers.RadioButtonGroupController();

            // Construct the cells. They will self-register with the group controller in their constructors.
            // The second parameter indicates the cell's initial checked state.  It only makes
            // sense for one of thes cells in the group to be initially checked.
            SourceGrid.Cells.RadioButton cell1 = new SourceGrid.Cells.RadioButton("Group 1, Cell 1", true, group);
            SourceGrid.Cells.RadioButton cell2 = new SourceGrid.Cells.RadioButton("Group 1, Cell 2", false, group);
            SourceGrid.Cells.RadioButton cell3 = new SourceGrid.Cells.RadioButton("Group 1, Cell 3", false, group);

            // Add the cells to the grid.
            this._sourceGrid[1, 1] = cell1;
            this._sourceGrid[2, 1] = cell2;
            this._sourceGrid[3, 1] = cell3;

            // That's it.  We're done.
            // NOTE: You will need to subscribe to cell events if outside entities
            //       need notification of a cell's state changing.
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        private void BuildRadioButtonCellGroup4()
        {
            // Allocate a RadioButtonGroupController for this group.
            SourceGrid.Cells.Controllers.RadioButtonGroupController group = new SourceGrid.Cells.Controllers.RadioButtonGroupController();

            // Construct the cells.
            SourceGrid.Cells.RadioButton cell1 = new SourceGrid.Cells.RadioButton("Group 4, Cell 1", true, group);
            SourceGrid.Cells.RadioButton cell2 = new SourceGrid.Cells.RadioButton("Group 4, Cell 2", false, group);
            SourceGrid.Cells.RadioButton cell3 = new SourceGrid.Cells.RadioButton("Group 4, Cell 3", false, group);

            // Add the cells to the grid.
            this._sourceGrid[2, 3] = cell1;
            this._sourceGrid[2, 4] = cell2;
            this._sourceGrid[2, 5] = cell3;
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        private void BuildRadioButtonCellGroup2()
        {
            // Allocate a RadioButtonGroupController for this group.
            SourceGrid.Cells.Controllers.RadioButtonGroupController group = new SourceGrid.Cells.Controllers.RadioButtonGroupController();

            // Construct the cells.
            SourceGrid.Cells.RadioButton cell1 = new SourceGrid.Cells.RadioButton("Group 2, Cell 1", true, group);
            SourceGrid.Cells.RadioButton cell2 = new SourceGrid.Cells.RadioButton("Group 2, Cell 2", false, group);
            SourceGrid.Cells.RadioButton cell3 = new SourceGrid.Cells.RadioButton("Group 2, Cell 3", false, group);
            SourceGrid.Cells.RadioButton cell4 = new SourceGrid.Cells.RadioButton("Group 2, Cell 4", false, group);
            SourceGrid.Cells.RadioButton cell5 = new SourceGrid.Cells.RadioButton("Group 2, Cell 5", false, group);

            // Add the cells to the grid.
            this._sourceGrid[5, 1] = cell1;
            this._sourceGrid[6, 1] = cell2;
            this._sourceGrid[7, 1] = cell3;
            this._sourceGrid[8, 1] = cell4;
            this._sourceGrid[9, 1] = cell5;
        }
Пример #4
0
        /// <summary>
        /// Called when the checked button has changed in a radio button cell group.
        /// Basically, note the cell passed in sender's state and if it is checked
        /// we uncheck all other buttons in the array list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UIChangeChecked(CellContext sender, EventArgs e)
        {
            // See if the passed cell is checked.
            // If so, unckeck all the other cells.

            SourceGrid.Cells.RadioButton cell = sender.Cell as SourceGrid.Cells.RadioButton;
            if (cell != null)
            {
                if (cell.Checked)
                {
                    foreach (SourceGrid.Cells.RadioButton c in this._radioButtons)
                    {
                        if (c != cell)
                        {
                            if (c.Checked)
                            {
                                c.Checked = false;
                            }
                        }
                    }
                }
            }
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        private void BuildRadioButtonCellGroup5()
        {
            // Allocate a RadioButtonGroupController for this group.
            SourceGrid.Cells.Controllers.RadioButtonGroupController group = new SourceGrid.Cells.Controllers.RadioButtonGroupController();

            // Construct the cells.
            SourceGrid.Cells.RadioButton cell1 = new SourceGrid.Cells.RadioButton("Group 5, Cell 1", true, group);
            SourceGrid.Cells.RadioButton cell2 = new SourceGrid.Cells.RadioButton("Group 5, Cell 2", false, group);
            SourceGrid.Cells.RadioButton cell3 = new SourceGrid.Cells.RadioButton("Group 5, Cell 3", false, group);
            SourceGrid.Cells.RadioButton cell4 = new SourceGrid.Cells.RadioButton("Group 5, Cell 4", false, group);
            SourceGrid.Cells.RadioButton cell5 = new SourceGrid.Cells.RadioButton("Group 5, Cell 5", false, group);
            SourceGrid.Cells.RadioButton cell6 = new SourceGrid.Cells.RadioButton("Group 5, Cell 6", false, group);
            SourceGrid.Cells.RadioButton cell7 = new SourceGrid.Cells.RadioButton("Group 5, Cell 7", false, group);

            // Add the cells to the grid.
            this._sourceGrid[7, 3]  = cell1;
            this._sourceGrid[8, 4]  = cell2;
            this._sourceGrid[9, 5]  = cell3;
            this._sourceGrid[10, 4] = cell4;
            this._sourceGrid[9, 6]  = cell5;
            this._sourceGrid[15, 3] = cell6;
            this._sourceGrid[19, 4] = cell7;
        }