We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Radio Buttons

Thread ID:

Created:

Updated:

Platform:

Replies:

64571 Jul 23,2007 02:44 PM UTC Jul 23,2007 03:17 PM UTC WinForms 1
loading
Tags: GridControl
shuvendu
Asked On July 23, 2007 02:44 PM UTC

Hi all,

I want RadioButton celltype in vertical orientation in Sync Fusion GridControl. By default it is Horizontal.

Thanks in Advance.

haneefm [Syncfusion]
Replied On July 23, 2007 03:17 PM UTC

Hi Shuvendu,

There is no built-in support for this.To need this support, You would have to derive the RadioButtonCellRenderer and override this method to create the Custom Celltypes.

protected override System.Drawing.Rectangle OnLayout(int rowIndex, int colIndex, Syncfusion.Windows.Forms.Grid.GridStyleInfo style, System.Drawing.Rectangle innerBounds, System.Drawing.Rectangle[] buttonsBounds)
{
Rectangle clientRectangle = GridMargins.RemoveMargins(innerBounds, style.TextMargins.ToMargins());
StringCollection buttonInfos = style.ChoiceList;
int count = buttonInfos != null ? buttonInfos.Count : 0;
if (buttonInfos != null && count > 0)
{
int width = clientRectangle.Width ;
int height = clientRectangle.Height/count;
if (height == 0)
height = clientRectangle.Height;
GridVerticalAlignment verticalAlign = style.VerticalAlignment;
int yOffset = clientRectangle.Top;
if (verticalAlign == GridVerticalAlignment.Middle)
yOffset += (clientRectangle.Height - height)/2;
else if (verticalAlign == GridVerticalAlignment.Bottom)
yOffset += (clientRectangle.Height - height);
int xOffset = clientRectangle.Left;
for (int n = 0; n < count; n++)
{
Rectangle bounds = new Rectangle(xOffset, yOffset, width, height);
buttonsBounds[n] = bounds;
if(buttonInfos != null)
{
((GridRadioButton)GetButton(n)).Enabled = this.GetButtonInfo(n, style).Enabled;
}
yOffset += height;
}
}
clientRectangle.Width = 0;
return clientRectangle;
}

A custom CellType can be created, it requires a model class and a renderer class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell. This sample in \Syncfusion\Essential Studio\4.1.0.10\windows\Grid.Windows\Samples\In Depth\DerivedCellControlTutorial can be referred.

After creating the custom celltype, it has to be registered through CellModels.Add

this.gridControl1.CellModels.Add("MyRadioButton", new MyRadioButtonCellModel(this.gridControl1.Model));

Please take a look at the sample for more details.
RadioButton.zip

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;