I have an UltraWinGrid where I am in the BeforeCellActivate event trying to make some changes. Within the delegate for this event, I am setting the ValueList. Upon doing this the column cell Editor changes to become EditorWithCombo. The ValueList is properly shown when clicked upon. However, what I'm trying to do is show the items in the ValueList so that the top line might either be bold or in a larger font, while a second line (description) is shown in a normal font, possibly a smaller font.
I was trying to explore if there was a way to use UltraFormattedTextEditor for each value item (or if there was a property to somehow allow rich text) but I am not seeing that. On the row cell property Style - when I try setting that to ColumnStyle.FormattedText it has no bearing on the underlying value items. I was hoping that there might be a similar property that I can use.
Is there a techiique I can follow to achieve this ?
Thank you for helping to look into this issue. It is very appreciated.
I am actually just using a vanilla ValueList, and in fact just adding items to the ValueListItems collection as shown in the first screenshot. In the second screenshot what I did was added to the collection by doing "Item\nmy description" with a line feed. Of course that shows no styling. I am wanting to switch out the editor or apply styling in any way that is possible.
Hello,
I am glad that you managed to achieve your requirement.
Please do not hesitate to let me know if you have any further questions on this matter.
Regards,Teodosia HristodorovaAssociate Software DeveloperInfragistics
thank you very much for your help
Using UltraDropDown is definitely the way to go here. But using every other row of data for Name and Description is not ideal. Your sample is handling MouseDown and diverting the selection to the appropriate row, but that won't work if you select a row in the dropdown via the keyboard.
A better way to handle this is to use Groups and Levels. That way, you have a single dropdown row that has two levels of data in it. And you don't need to worry about where the user clicks.I changed the sample to do it this way so that keyboard interaction still works correctly. I also made some minor changes to other areas - like I changed the Category column to an Integer so it matches up with the ValueMember of the DropDown. This was causing some internal exceptions and the dropdown had some weird display issues when you dropped it down in the original sample. :)
4532.2021.UltraWinGrid_Style_Items_in_ComboEditor.zip
Thank you for the provided screenshots.
My suggestion in order to achieve different styling on the Items and descriptions is to use UltraDropDown instead of ValueList and set it to the Column ValueList Property:
private void UltraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Bands[0].Columns[2].ValueList = this.ultraDropDown1; }
UltraDropdown is a much more powerful ValueList. It is essentially a dropdown UltraWinGrid (although it is limited to a single band). Just like the WinGrid, it must be bound and has a wide range of Appearances and features such as sorting, filtering, and resizable columns. You could change its appearance in order to look like a Value list.
I have created a small sample where the Items are on the even rows and the descriptions on the odd. So you could set the ForeData Bold property to true only if the row index is even and change the font size using the SizeInPoints property:
private void UltraDropDown1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if(e.Row.Index % 2 == 0) { e.Row.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True; } else { e.Row.Appearance.FontData.SizeInPoints = 7; } }
I have attached a sample application, that uses this approach. Please test it on your side and let me know if I may be of any further assistance.
Sincerely,
Teodosia Hristodorova
Associate Software Developer
2021.UltraWinGrid_Style_Items_in_ComboEditor.zip