I have an ultraWinGrid and have a value list in one of the columns and everything looks great. I have all the data I need and this is working fine.
I now want to prevent the user from selecting certain items in the list. So If I have a "your Pet" list of Cat, Dog and Dragon I want to display all 3, but prevent the user from being able to slect Dragon. Is that possible? I would also like to change the color to a greyed out disabled color.
See my code below.
for (int
i = 0; i < dataRowCollection.Count; i++)
{
if (dataRowCollection[i]["Validated"].ToString() == "True")
ValueListItem
item = ultraWinGrid.DisplayLayout.ValueLists[valueListName].ValueListItems.Add(dataRowCollection[i][dataValueField], dataRowCollection[i][displayTextField].ToString());
}
else
//Disable and do not let the user select this item
No, the ValueList does not support the disabling of items. It is possible that you could do something like this using the IUIElementCreationFilter interface to set the ValueListItemUIElement's Enabled property to false for the items that should be disabled, but I have never tried that so I am not certain it will work. Another solution might be to handle SelectionChanged and just not react to the selection of certain items.
Another solution would be to use an UltraDropDown control instead of a ValueList. The UltraDropDown supports disabling rows.
Can you give an example on how to do this?