Hello,
is there any easy way to use a custom RadGridView as grid element of the MultiColumnComboBox?
Or do I need to override the hole object chain?
in RadMultiColumnComboBox.cs
protected
virtual
RadMultiColumnComboBoxElement CreateMultiColumnComboBoxElement()
in RadMultiColumnComboBoxElement.cs
public
MultiColumnComboPopupForm MultiColumnPopupForm
// not virtual?!
in MultiColumnComboPopupForm.cs
protected
virtual
void
InitializeEditorElement()
in GridViewHostItem.cs
public
GridViewHostItem() :
base
(
new
MultiColumnComboGridView())
public
MultiColumnComboGridView HostedGridView
// not virtual?!
...
Are there any examples?
Kind regards,
Christian
6 Answers, 1 is accepted
Thank you for writing.
Currently, that is not possible without actually changing the source code. I logged a request on our feedback portal and I have also voted for it on your behalf. The item is located here: IMPROVE. RadMultiColumnComboBox - expose an API for using a custom RadGridView control in the popup form. Additionally, you can subscribe to it and be updated with all of its status changes. You Telerik points are also updated accordingly.
Can you please let me know what kind of custom behavior you would like to use with the custom grid control so that I can help you in achieving it?
I hope this helps. Looking forward to your reply.
Regards,
Hristo Merdjanov
Telerik by Progress
Hello Hristo,
thank you for putting this to the feedback portal.
The case was that I've a custom grid with amongst other things there are a lot of helper methods which I wanted to use with the MultiColumnComboBox Grid. I've rewrote some of them now as extension methods. But there are other custom features which I'd like to use in the future.
Kind regards,
Christian
Thank you for writing back.
I am glad that you have managed to find a suitable solution for now. In case you need to also use some of the custom features of your control please let us know. You can open a ticket and attach your project there.
I hope this helps. Please let me know if you need further assistance.
Regards,
Hristo Merdjanov
Telerik by Progress
Hello,
Has there been some update this to override the editor control for the multicolumncombobox? I am using virtual mode to optimize searches, but I need to be able to filter and sort across multiple columns while still using autocompletemode.
Thank you,
LT
Still, the item is not yet completed so I added a vote for it on your behalf. We will do our best to address the request in the R2 2019 release, scheduled for the beginning of May. Once the item is fully tested it will be merged in our branch with internal builds and the compiled assemblies can be downloaded and tested even before the official R2 version.
- https://docs.telerik.com/devtools/winforms/installation-and-upgrades/latest-internal-builds
- https://docs.telerik.com/devtools/winforms/installation-and-upgrades/updating-assemblies-in-a-project
Let me know if you need further assistance.
Regards,
Hristo
Progress Telerik
A fix will be available in LIB Version 2019.1.415 scheduled for April 15th. Exposing an API for using a custom RadGridView control in the popup form.
When fix is released you will be able to use custom RadGridView as grid element of the MultiColumnComboBox as follows:
using
System;
using
Telerik.WinControls;
using
Telerik.WinControls.UI;
namespace
MCCBCustomRadGridView
{
public
partial
class
RadFormCustomGrid : Telerik.WinControls.UI.RadForm
{
public
RadFormCustomGrid()
{
InitializeComponent();
}
private
void
RadFormCustomGrid_Load(
object
sender, EventArgs e)
{
this
.customersTableAdapter.Fill(
this
.nwindDataSet.Customers);
}
}
public
class
MyRadMultiColumnComboBox : RadMultiColumnComboBox
{
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadMultiColumnComboBox).FullName;
}
}
protected
override
RadMultiColumnComboBoxElement CreateMultiColumnComboBoxElement()
{
return
new
MyRadMultiColumnComboBoxElement();
}
}
public
class
MyRadMultiColumnComboBoxElement : RadMultiColumnComboBoxElement
{
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(RadMultiColumnComboBoxElement);
}
}
protected
override
RadPopupControlBase CreatePopupForm()
{
MultiColumnComboPopupForm popupForm =
new
MyMultiColumnComboPopupForm(
this
);
popupForm.EditorControl.Focusable =
false
;
popupForm.MinimumSize =
this
.DropDownMaxSize;
popupForm.MaximumSize =
this
.DropDownMaxSize;
popupForm.Height =
this
.DropDownHeight;
popupForm.VerticalAlignmentCorrectionMode = AlignmentCorrectionMode.SnapToOuterEdges;
popupForm.HorizontalAlignmentCorrectionMode = AlignmentCorrectionMode.Smooth;
popupForm.RightToLeft =
this
.RightToLeft ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.Inherit;
this
.WirePopupFormEvents(popupForm);
return
popupForm;
}
}
public
class
MyMultiColumnComboPopupForm : MultiColumnComboPopupForm
{
internal
bool
closed;
public
MyMultiColumnComboPopupForm(RadMultiColumnComboBoxElement element)
:
base
(element)
{ }
protected
override
GridViewHostItem CreateEditorElement()
{
return
new
MyGridViewHostItem();
}
/// <summary>
/// Fires when the popup is opened.
/// </summary>
protected
override
void
OnPopupOpened()
{
base
.OnPopupOpened();
closed =
false
;
}
/// <summary>
/// Fires when the popup is closed.
/// </summary>
/// <param name="args">A RadPopupClosedEventArgs instance
/// that contains information about what caused the popup to close.</param>
protected
override
void
OnPopupClosed(RadPopupClosedEventArgs args)
{
base
.OnPopupClosed(args);
closed =
true
;
}
}
public
class
MyGridViewHostItem : GridViewHostItem
{
public
MyGridViewHostItem()
:
base
(
new
MyRadGridView())
{ }
}
public
class
MyRadGridView : RadGridView
{
#region Ctor
public
MyRadGridView()
{
this
.GridBehavior =
new
MultiColumnComboGridBehavior();
}
protected
override
void
OnMouseDown(System.Windows.Forms.MouseEventArgs e)
{
MyMultiColumnComboPopupForm form =
this
.Parent
as
MyMultiColumnComboPopupForm;
if
(form !=
null
&& form.closed)
{
return
;
}
base
.OnMouseDown(e);
}
#endregion
#region Methods
protected
override
bool
ProcessFocusRequested(RadElement element)
{
return
false
;
}
public
override
string
ThemeClassName
{
get
{
return
"Telerik.WinControls.UI.RadGridView"
;
}
set
{
base
.ThemeClassName = value;
}
}
#endregion
}
}
You can also see the code inside the attached project.
Regards,
Dimitar
Progress Telerik