Hello Bharat,
Thank you for writing.
Your question has already been answered in the support thread you have opened on the same topic. However, I am posting the answer here as well in order the community to benefit from it. RadGridView provides a variety of visual cells (all inheriting from GridCellElement) with different functionality and purpose – header cells, indent cells, command cells, summary cells, group content cells, data cells, etc. All these cover the standard cases of thecontrol usage. In case you need to implement more specific and custom scenario, you can create a custom cell. Here is a sample code snippet demonstrating how to insert a RadDropDownListElement to each header cell. It is up to what action will be performed when changing the drop-down selection:
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Dess
Telerik
Thank you for writing.
Your question has already been answered in the support thread you have opened on the same topic. However, I am posting the answer here as well in order the community to benefit from it. RadGridView provides a variety of visual cells (all inheriting from GridCellElement) with different functionality and purpose – header cells, indent cells, command cells, summary cells, group content cells, data cells, etc. All these cover the standard cases of the
public Form1(){ InitializeComponent(); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.TableElement.TableHeaderHeight = 50; //register the custom row behavior BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewTableHeaderRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewTableHeaderRowInfo), new CustomGridHeaderRowBehavior());}private void Form1_Load(object sender, EventArgs e){ this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories);}private void radGridView1_CreateCell(object sender, Telerik.WinControls.UI.GridViewCreateCellEventArgs e){ if (e.CellType == typeof(GridHeaderCellElement)) { e.CellElement = new CustomGridHeaderCellElement(e.Column, e.Row); }}public class CustomGridHeaderCellElement : GridHeaderCellElement{ public CustomGridHeaderCellElement(GridViewColumn column, GridRowElement row) : base(column, row) { } protected override Type ThemeEffectiveType { get { return typeof(GridHeaderCellElement); } } StackLayoutElement stack = new StackLayoutElement(); RadDropDownListElement ddl = new RadDropDownListElement(); LightVisualElement headerElement = new LightVisualElement(); protected override void CreateChildElements() { base.CreateChildElements(); stack.Orientation = Orientation.Vertical; stack.StretchHorizontally = true; stack.StretchVertically = true; ddl.DropDownStyle = RadDropDownStyle.DropDownList; ddl.NotifyParentOnMouseInput = true; stack.Children.Add(headerElement); stack.Children.Add(ddl); this.Children.Add(stack); } protected override void BindColumnProperties() { base.BindColumnProperties(); UnbindProperty(TextProperty); } protected override void SetContentCore(object value) { base.SetContentCore(value); this.Text = string.Empty; headerElement.Text = this.ColumnInfo.HeaderText; if (ddl.DataSource == null) { ddl.DataSource = new List<string>() { headerElement.Text + "1", headerElement.Text + "2", headerElement.Text + "3" }; } }}public class CustomGridHeaderRowBehavior : GridHeaderRowBehavior{ public override bool OnMouseUp(MouseEventArgs e) { //prevent sorting when the header drop-down is clicked RadDropDownListElement elementUnderMouse = this.GridControl.GridViewElement.ElementTree.GetElementAtPoint(e.Location).FindAncestor<RadDropDownListElement>(); if (elementUnderMouse == null) { return base.OnMouseUp(e); } return true; }}I hope this information helps. Should you have further questions, I would be glad to help.
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items








