Hi,
i have a UltraWinGrid in which there is a cell composed of UltraTextEditor. in this cell, i want to enable user to select the items in a CheckedListBox, and then show the items in the cell. it would work like following,
The below is some code,
CheckedListBox listView = new CheckedListBox();
DropDownEditorButton dropDown = new DropDownEditorButton();
UltraTextEditor textEditor = new UltraTextEditor();
textEditor.Enabled = false;
textEditor.ReadOnly = true;
textEditor.ContextMenu = null;
dropDown.Control = listView;
textEditor.ButtonsRight.Add(dropDown);
listView.Sorted = true;
listView.ContextMenu = null;
listView.CheckOnClick = true;
listView.Width = cell.Width;
string[] items = .....
listView.Items.AddRange(items);
cell.EditorControl = textEditor;
...
cell.Value = selectedItems;
So my problem is, after the selected items showed in the cell, i don't want the user could edit them or type anything in the cell, i make it work by capturing the keyboard events. but the user could still right click on the showed text to pop-up the contextmenu to do "cut" or sth else. so how do i disable this?
thanks.
What version of the controls are you using?
The latest version has built-in support for multiple selection using the UltraComboEditor so you do not need to use a ListView.
If you want the user to only choose from the list and not type, then you should set the column's Style to DropDownList.
HI, Mike
Thank you for your answer.
The version i am using is NetAdvantage 10.3.20103.1000.
I am trying UltraComboEditor as you suggested, but met another problem "Unable to updateData", it
throws an exception said "Value in the editor is not valid.", the issue is similar to this thread: http://community.infragistics.com/forums/t/48458.aspx
But i don't think the solution proposed in that thread could make it work.
I add UltraComboEditor to the grid in the following Event handler,
private void ultraGrid1_BeforeCellActivate(object sender, IWG.CancelableCellEventArgs e)
{
e.Cell.Column.Style = IWG.ColumnStyle.DropDownList;
UltraComboEditor editor = new UltraComboEditor();
editor.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
editor.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.CheckBox;
editor.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems;
editor.CheckedListSettings.ListSeparator = ",";
editor.ValueList = this.ultraGrid1.DisplayLayout.ValueLists[propertyName];
cell.EditorComponent = editor;
}
It pops up the checkedlist box successfully when i click the cell, but when i try to select one more item, it will throw the exception mentioned above.
So could you give any hints, thank you.