/// <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. }
/// <summary> /// Construct a CellRadioButton class with caption and align RadioButton in the /// MiddleLeft, using BehaviorModels.RadioButton.Default /// </summary> /// <param name="caption"></param> /// <param name="checkValue"></param> public RadioButton(string caption, bool checkValue, SourceGrid.Cells.Controllers.RadioButtonGroupController group) : base(checkValue) { if (caption != null && caption.Length > 0) { View = Views.RadioButton.MiddleLeftAlign; } else { View = Views.RadioButton.Default; } Model.AddModel(new Models.RadioButton()); AddController(Controllers.RadioButton.Default); AddController(Controllers.MouseInvalidate.Default); Editor = new Editors.EditorBase(typeof(bool)); //used also because the space key are directly used by the controller, so must not start an edit operation Editor.EditableMode = SourceGrid.EditableMode.None; Caption = caption; // Add this cell to the group. if (group != null) { group.AppendCell(this); AddController(group); } }
/// <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; }
/// <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; }
/// <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; }