Hello all,
in 2011 Q1 winforms, i have a user control inherited from RadMultiColumnComboBox, and the filter row for inner radgrid is enabled.
problem is when i click on the filter row, the popup close ! so i cannot get focus on the filter row textbox to type the filtering text .
would you please tell me why this is occuring and how can i solve it ?
Thank you,
in 2011 Q1 winforms, i have a user control inherited from RadMultiColumnComboBox, and the filter row for inner radgrid is enabled.
problem is when i click on the filter row, the popup close ! so i cannot get focus on the filter row textbox to type the filtering text .
would you please tell me why this is occuring and how can i solve it ?
Thank you,
8 Answers, 1 is accepted
0
Boris
Top achievements
Rank 1
answered on 01 Nov 2011, 07:06 AM
Hi,
I have the same problem.
Do you have any solution for this problem?
Thank you!
I have the same problem.
Do you have any solution for this problem?
Thank you!
0
Brad
Top achievements
Rank 1
answered on 09 Dec 2011, 05:56 PM
Hi, I have solved the problem with this code, when using a Form Level Multi Column Combo Box:
When using the Multi Column Combo Box Column in a GridView I use this code:
/// <summary>
/// Cancel MultiColumnComboBox Close on heaader or filter field click
/// </summary>
private
void
MultiColumnComboBox_DropDownClosing(
object
sender, RadPopupClosingEventArgs args)
{
if
((sender
as
RadMultiColumnComboBox).SelectedIndex == -1)
{
args.Cancel =
true
;
}
}
When using the Multi Column Combo Box Column in a GridView I use this code:
/// <summary>
/// Cancel MultiColumnComboBox Column Close on header or filter field click
/// </summary>
private
void
radMultiColumnComboBox_Generic_PopupClosing(
object
sender, RadPopupClosingEventArgs args)
{
if
((sender
as
RadMultiColumnComboBoxElement).SelectedIndex == -1)
{
if
((sender
as
RadMultiColumnComboBoxElement).Rows.Count > 0)
args.Cancel =
true
;
}
}
0
Ofer
Top achievements
Rank 1
answered on 31 Jan 2012, 07:35 AM
Hi Brand,
I used your first code and it's good. thanks.
But i wander way the don't fix it in Telerik.
Any way the way to close the grid without selecting any row is to click the combo itself.
The problem is that if i click the filtering row i can't close the grid without selecting.
Do you have solution for this?
Thanks'
Ofer.
I used your first code and it's good. thanks.
But i wander way the don't fix it in Telerik.
Any way the way to close the grid without selecting any row is to click the combo itself.
The problem is that if i click the filtering row i can't close the grid without selecting.
Do you have solution for this?
Thanks'
Ofer.
0
Brad
Top achievements
Rank 1
answered on 20 Feb 2012, 11:51 PM
The problem is that if i click the filtering row i can't close the grid without selecting. Do you have solution for this?
I do not have a solution for this. This column is a required field in my program so it works well for me to force a selection. Without the extra check for some "possible selection" rows in the filtered RadGridView MultiColumnComboBox, user clicks could throw an exception that I couldn't handle and would crash my program.
I do not have a solution for this. This column is a required field in my program so it works well for me to force a selection. Without the extra check for some "possible selection" rows in the filtered RadGridView MultiColumnComboBox, user clicks could throw an exception that I couldn't handle and would crash my program.
0
Felix
Top achievements
Rank 1
answered on 20 Oct 2013, 08:26 PM
I've worked on a simple way of enabling/disabling filtering in RadMultiColumnComboBox.
It's an extension method.
The usage is
It's not bug free, but as far as I've tested it works in a nice way.
When filtering is enabled, a filter row will appear when clicking on the RadMultiColumnComboBox. Many filters may be written once (multi column filtering). After the popup is closed, all the filters will be erased.
When clicking outside of the popup, or clicking on a row (not the filter one), the popup will be automatically closed.
And the extension method code
Hope this helps someone!
It's an extension method.
The usage is
theCombo.Filtering(
true
);
//Enabling
theCombo.Filtering(
false
);
//Disabling
It's not bug free, but as far as I've tested it works in a nice way.
When filtering is enabled, a filter row will appear when clicking on the RadMultiColumnComboBox. Many filters may be written once (multi column filtering). After the popup is closed, all the filters will be erased.
When clicking outside of the popup, or clicking on a row (not the filter one), the popup will be automatically closed.
And the extension method code
internal
static
class
ExtensionsRadMultiColumnComboBox
{
public
static
void
Filtering(
this
RadMultiColumnComboBox combo,
bool
enable)
{
if
(enable)
{
if
(!combo.EditorControl.EnableFiltering)
{
combo.DropDownClosing += RadMultiColumnComboBoxDropDownClosing;
var multiColumnComboBoxElement = combo.MultiColumnComboBoxElement;
multiColumnComboBoxElement.EditorControl.EnableFiltering =
true
;
multiColumnComboBoxElement.EditorControl.ShowFilteringRow =
true
;
multiColumnComboBoxElement.EditorControl.FilterChanging +=
RadMultiColumnComboBoxEditorControlFilterChanging;
}
}
else
{
if
(combo.EditorControl.EnableFiltering)
{
combo.DropDownClosing -= RadMultiColumnComboBoxDropDownClosing;
var multiColumnComboBoxElement = combo.MultiColumnComboBoxElement;
multiColumnComboBoxElement.EditorControl.EnableFiltering =
false
;
multiColumnComboBoxElement.EditorControl.ShowFilteringRow =
false
;
multiColumnComboBoxElement.EditorControl.FilterChanging -=
RadMultiColumnComboBoxEditorControlFilterChanging;
}
}
}
private
static
void
RadMultiColumnComboBoxEditorControlFilterChanging(
object
sender,
GridViewCollectionChangingEventArgs e)
{
var multiColumnComboGridView = sender
as
MultiColumnComboGridView;
if
(multiColumnComboGridView ==
null
)
return
;
if
(multiColumnComboGridView.Parent ==
null
)
return
;
var radPopupControlBase = multiColumnComboGridView.Parent
as
MultiColumnComboPopupForm;
if
(radPopupControlBase ==
null
)
return
;
if
(!radPopupControlBase.IsDisplayed)
return
;
if
(e.OldItems ==
null
)
return
;
if
(e.OldItems.Count == 0)
return
;
var filterDescriptor = e.OldItems[0]
as
FilterDescriptor;
if
(filterDescriptor ==
null
)
return
;
var grid = multiColumnComboGridView;
var currentRow = grid.CurrentRow;
if
(currentRow.RowElementType !=
typeof
(GridFilterRowElement))
return
;
var value = currentRow.Cells[filterDescriptor.PropertyName].Value ??
string
.Empty;
if
(value ==
null
)
return
;
string
activeEditorString =
null
;
if
(grid.ActiveEditor !=
null
)
{
var activeEditorValue = grid.ActiveEditor.Value ??
string
.Empty;
activeEditorString = activeEditorValue.ToString();
}
if
(e.NewValue ==
null
&& value.ToString() !=
string
.Empty &&
!(activeEditorString !=
null
&& activeEditorString ==
string
.Empty &&
grid.CurrentColumn.Name == filterDescriptor.PropertyName))
e.Cancel =
true
;
}
private
static
void
RadMultiColumnComboBoxDropDownClosing(
object
sender, RadPopupClosingEventArgs args)
{
var radMultiColumnComboBox = sender
as
RadMultiColumnComboBox;
if
(radMultiColumnComboBox ==
null
)
return
;
var popupForm = radMultiColumnComboBox.MultiColumnComboBoxElement.PopupForm;
var editorControl = radMultiColumnComboBox.MultiColumnComboBoxElement.EditorControl;
MultiColumnComboBoxDropDownClosingHandler(popupForm, editorControl, args);
}
private
static
void
MultiColumnComboBoxDropDownClosingHandler(RadPopupControlBase popupForm,
RadGridView editorControl, RadPopupClosingEventArgs args)
{
var mousePosition = Control.MousePosition;
var xIn = mousePosition.X >= popupForm.Location.X &&
mousePosition.X <= popupForm.Location.X + popupForm.Size.Width;
var yIn = mousePosition.Y >= popupForm.Location.Y &&
mousePosition.Y <= popupForm.Location.Y + popupForm.Size.Height;
if
(editorControl.CurrentRow.Index == -1 && xIn && yIn)
{
args.Cancel =
true
;
}
else
{
if
(editorControl.ActiveEditor !=
null
)
{
editorControl.ActiveEditor.EndEdit();
}
editorControl.FilterChanging -= RadMultiColumnComboBoxEditorControlFilterChanging;
foreach
(var column
in
editorControl.Columns)
{
column.FilterDescriptor =
null
;
}
editorControl.FilterChanging += RadMultiColumnComboBoxEditorControlFilterChanging;
}
}
}
Hope this helps someone!
0
Hello Felix,
Thank you for sharing your code with the community. I am sure someone will benefit from it.
I have updated your Telerik points for the contribution.
Greetings,
Desislava
Telerik
Thank you for sharing your code with the community. I am sure someone will benefit from it.
I have updated your Telerik points for the contribution.
Greetings,
Desislava
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 >>
0
Mahdi
Top achievements
Rank 1
answered on 05 Oct 2016, 05:21 AM
hi,
how to use your code, can you explain more?
thanks
0
Hello Mahdi,
Thank you for writing.
The provided code snippet by Felix demonstrates how to create an extension Filtering method for the RadMultiColumnComboBox. It enables the filtering row in the popup grid. I have attached a sample project for your reference.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress
Thank you for writing.
The provided code snippet by Felix demonstrates how to create an extension Filtering method for the RadMultiColumnComboBox. It enables the filtering row in the popup grid. I have attached a sample project for your reference.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.