4 Answers, 1 is accepted
0
OneZero
Top achievements
Rank 1
answered on 21 Dec 2007, 07:38 AM
1. Set the gridView Dock property to Fill
2. Make a CustomContextMenuStrip and set it as a property Context Menu of the grid (don't forget to disable the AllowCellContextMenu property).
I hope it solves your problems.
2. Make a CustomContextMenuStrip and set it as a property Context Menu of the grid (don't forget to disable the AllowCellContextMenu property).
I hope it solves your problems.
0
Hi Quyen Ho,
Thank you for writing us.
You have two options to synchronize RadGridView size with its parent form size:
Currently, the easiest way of customizing the ContextMenu in the grid is to inherit from the RadGridView class. We will improve this in our future releases. The following sample demonstrates this behavior:
In case you have further questions, do not hesitate to contact us.
Greetings,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for writing us.
You have two options to synchronize RadGridView size with its parent form size:
- Use the Dock property of RadGridView. Set it to a value of Fill. This way the control will resize to fill the available size in the form.
- Use the Anchor property of RadGridView. Set it to Left, Right, Top, and Bottom. The size of the grid will adjust to fill the form area.
this.radGridView1.MasterGridViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; |
Currently, the easiest way of customizing the ContextMenu in the grid is to inherit from the RadGridView class. We will improve this in our future releases. The following sample demonstrates this behavior:
public class MyGridView : RadGridView |
{ |
protected override void OnMouseDown(MouseEventArgs e) |
{ |
if (e.Button == MouseButtons.Right) |
{ |
RadDropDownMenu menu = new RadDropDownMenu(); |
menu.Items.Add(new RadMenuItem("Item 1")); |
menu.Items.Add(new RadMenuItem("Item 2")); |
menu.Items.Add(new RadMenuItem("Item 3")); |
menu.Show(this, e.Location); |
} |
else |
{ |
base.OnMouseDown(e); |
} |
} |
public override string ThemeClassName |
{ |
get |
{ |
return typeof(RadGridView).FullName; |
} |
set |
{ |
} |
} |
} |
In case you have further questions, do not hesitate to contact us.
Greetings,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Doug
Top achievements
Rank 1
answered on 24 Jul 2013, 09:38 PM
Can you set the AutoSizeColumnsMode for just one column?
I tried myGridView.MasterGridViewInfo.ViewTemplate.Columns["myColumn"]. ... and couldn't get the AutoSizeColumnMode property to show up.
I tried myGridView.MasterGridViewInfo.ViewTemplate.Columns["myColumn"]. ... and couldn't get the AutoSizeColumnMode property to show up.
0
Hello Gary,
As the property name implies it concerns multiple columns and it controls all columns in a template. Such property does not exist of per column level and this is why you cannot find it. If you want to make a column wide enough to display its contents, you can call its BestFit method.
More information about this matter is available here: http://www.telerik.com/help/winforms/gridview-columns-resizing-columns-programatically.html.
I hope this helps.
Regards,
Stefan
Telerik
As the property name implies it concerns multiple columns and it controls all columns in a template. Such property does not exist of per column level and this is why you cannot find it. If you want to make a column wide enough to display its contents, you can call its BestFit method.
More information about this matter is available here: http://www.telerik.com/help/winforms/gridview-columns-resizing-columns-programatically.html.
I hope this helps.
Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>