On a prior post, I received help to be able to show descriptions in a smaller font underneath each item in an UltraDropDown within a cell in a grid. That help was much appreciated. The issue I'm having now is related to styling. It would look more appealing if the descriptions (were aligned to the top and did not have a vertical gap between the item for which the descriptions appear below.
The code from the post can be used as a baseline: https://ko.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/121729/ultawingrid---column-having-cell-with-editorwithcombo-dropdown-valuelist---trying-to-show-a-description-underneath-each-item-with-a-smaller-font
Attached please find a screenshot - where I'm trying to find a way to style this to remove this vertical gap and to have the descriptions in the gray font to appear right underneath the item.
question 2 - I couldn't figure out which appearance to modify so that when the hover is on an item that the color remains gray for the description. In the screenshot it is showing as black.
thank you
Hello,
Thank you for providing the reference post. I tried to run the sample Mike Saltzsman provided but for some reason it was not loading for me so I requested him to provide the sample again as a baseline.
About your frst issue I am not sure from where this vertical space is coming from , may be you have RowLayout and there are other cells in there taking up space?
In order to reproduce the issue please update the attached sample and send me back for further investigation.
About the second issue, you can do something like this:
private void UltraDropDown1_InitializeRow(object sender, InitializeRowEventArgs e) { e.Row.Cells["Description"].SelectedAppearance.ForeColor = Color.Gray; } or another way is create an Appearance object (ONCE) with a ForeColor and assign that instead, would be more efficient.
I attached MikeS sample with updated style please modify it to reproduce the first issue and send me back .
Sincerely,Divya jain
8270.UltraWinGrid_Style_Items_in_ComboEditor.zip
Thank you very much for your help. I have modified the solution that exhibits the behavior described above.
Please find the solution here:
www.dropbox.com/.../UltraWinGrid_Style_Items_in_ComboEditor.zip
Hi,
First... it's really hard to work with the sample you attached here, because it's blowing up with Exceptions all over the place. This is because you have some type mismatches between the ValueMember in your dropdown and the actual DataType of the grid cell. And also because your InitializeLayout code is getting hit more than once you are trying to create Appearance objects that already exist with the same key.
In ant case, what's happening here is that since you are using groups and levels, each level within the row has the same height. So the height is divided evenly between the two levels. So since the Description column is Multiline, the Identifier column ends up with the same height, even though it doesn't need that much room.
There's no way around that with Groups and Levels. That's just a limitation of that RowLayoutStyle.
But you could use RowLayoutStyle.ColumnLayout, instead. It's a bit more complex to set up, but it will distribute the space more efficiently. The code to do that looks something like this:
//// In order to make the description appear below the name, we need to use groups and //// levels. This create two levels for each row of data. //band.GroupHeadersVisible = false; //if (band.Groups.Count == 0) //{ // var group = band.Groups.Add("Group 0"); // nameColumn.Group = group; // descriptionColumn.Group = group; // band.LevelCount = 2; // descriptionColumn.Level = 1; //} band.RowLayoutStyle = RowLayoutStyle.ColumnLayout; nameColumn.RowLayoutColumnInfo.OriginX = 0; nameColumn.RowLayoutColumnInfo.OriginY = 0; nameColumn.RowLayoutColumnInfo.SpanX = 2; nameColumn.RowLayoutColumnInfo.SpanY = 2; descriptionColumn.RowLayoutColumnInfo.OriginX = 0; descriptionColumn.RowLayoutColumnInfo.OriginY = 2; descriptionColumn.RowLayoutColumnInfo.SpanX = 2; descriptionColumn.RowLayoutColumnInfo.SpanY = 2;
Doing this in your sample gets you most of the way there, but there's still an issue because your code is AutoSizing the Description column. So you end up with a very WIDE dropdown. In order to get the description to show up multiline instead of taking up all of the available horizontal space, you need to remove this line of code: cboStyledActions.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand);
What you might want to do instead, is to simply autosize the Idenitifer column to that the width of the dropdown is determine by the longest Identifier and then the Description wraps to multiple lines.
//cboStyledActions.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand); cboStyledActions.DisplayLayout.Bands[0].Columns["Identifier"].PerformAutoResize(PerformAutoSizeType.AllRowsInBand);