In my RadMultiColumnCombobox. I have added two buttons to the EditorControl's GridView area( image 2) . i want to add controls above and below of the radgridview. Also how to change the radgridview's header text color and background as well as alternate row background like the image given below.( image 1).
Please help
13 Answers, 1 is accepted
Thank you for writing.
In this case, the grid and the sizing grip are added to a DockLayoutPanel. So to add other elements you need to override the CreatePopupForm method and insert the new items. Please note that the items should be inserted in the first position and you need to set their Dock property. For example:
class
MyMCCB : RadMultiColumnComboBox
{
protected
override
RadMultiColumnComboBoxElement CreateMultiColumnComboBoxElement()
{
return
new
MyMCCBElemnt();
}
public
override
string
ThemeName
{
get
{
return
typeof
(RadMultiColumnComboBox).FullName;
}
}
}
class
MyMCCBElemnt : RadMultiColumnComboBoxElement
{
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(RadMultiColumnComboBoxElement);
}
}
protected
override
RadPopupControlBase CreatePopupForm()
{
var form =
base
.CreatePopupForm()
as
MultiColumnComboPopupForm;
StackLayoutElement stack =
new
StackLayoutElement();
stack.Orientation = Orientation.Horizontal;
RadButtonElement button1 =
new
RadButtonElement();
button1.Text =
"Button1"
;
button1.StretchHorizontally =
false
;
button1.StretchVertically =
false
;
RadButtonElement button2 =
new
RadButtonElement();
button2.Text =
"Button2"
;
button2.StretchHorizontally =
false
;
button2.StretchVertically =
false
;
stack.Children.Add(button1);
stack.Children.Add(button2);
DockLayoutPanel.SetDock(stack, Telerik.WinControls.Layouts.Dock.Top);
form.SizingGripDockLayout.Children.Insert(0, stack);
return
form;
}
}
Detailed information about how you can build controls with TPF is available in the following articles:
Another approach would be to use the PopupEditor control.
I hope this will be useful.
Regards,
Dimitar
Telerik
Hi Dimitar ,
thanks, we will check these options and get back.
Take all the time you need to examine this and do not hesitate to contact us if you have further questions.
Regards,
Dimitar
Telerik
Hi Dimitar,
I want to change the RadButtonElement's style inside the StackLayoutElement. I tried to change its properties and it is not reflecting in the button.Please help me.
Thank you for writing back.
Could you please specify which properties you want to change? This way I will be able to provide you with the proper solution.
I am looking forward to your reply.
Regards,
Dimitar
Telerik
Hi Dimitar,
This is how the combobox (See the image dropdown) look like now. I want to change the close button's style. Changing style not reflecting on the button. Please help me.
Thanks,
Rashad
Thank you for writing back.
You cannot change the theme of a single element, in this case, you need to manually change the styles. For example:
RadButtonElement button1 =
new
RadButtonElement();
button1.Text =
"Button1"
;
button1.StretchHorizontally =
false
;
button1.StretchVertically =
false
;
button1.ButtonFillElement.BackColor = Color.Blue;
button1.ButtonFillElement.GradientStyle = GradientStyles.Solid;
button1.ForeColor = Color.Red;
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Hi Dimitar,
Thank you for your response. I tried the above code and still I cannot not change the background or foreground color. The button theme is same as 'office2007Silver' theme. What may be the reason, Am I missing anything.
Thanks,
Rashad
Thank you for writing back.
Without examining your project I cannot say why this is not working on your side. This is why I would suggest you to post a support ticket. This way you can attach your project and we will be able to examine it and determine why the styles are not applied.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Hi Dimitar,
I need one more help. In my multicolumncombobox I feel difficult to scroll the grid. It is like deferred scrolling. I checked with changing the scroll mode using the below code.
this
.MultiColumnComboBoxElement.EditorControl.TableElement.RowScroller.ScrollMode = ItemScrollerScrollModes.Smooth;
but it seems not working. Still it scrolls like deferred. Please help me.
Thank you for writing.
This is controlled by the EnableFastScrolling property:
myMCCB1.EditorControl.EnableFastScrolling =
false
;
Please let me know if there is something else I can help you with.
Dimitar
Telerik
Hi Dimitar,
I want to get the scroll event for MultiColumnComboBox. How to catch the scroll event when the EditorControl(RadGridView) is scrolled.
You can use the CellEditorInitialized event to access the editor:
private
void
RadGridView1_CellEditorInitialized(
object
sender, GridViewCellEventArgs e)
{
if
(e.ActiveEditor
is
RadMultiColumnComboBoxElement)
{
var editor = e.ActiveEditor
as
RadMultiColumnComboBoxElement;
editor.EditorControl.TableElement.VScrollBar.Scroll -= VScrollBar_Scroll;
editor.EditorControl.TableElement.VScrollBar.Scroll += VScrollBar_Scroll;
}
}
private
void
VScrollBar_Scroll(
object
sender, ScrollEventArgs e)
{
}
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress