How to change the row height according to the value in the cell for a dynamically designed cardview.
Yea thats what iam searching for, too!
my Text is cutten from the grid.
its a long text but all I can see from him is the first row. Mouseover shows me the rest of the text. :-(
All the hints from the other users are not useable caus this is cardview and theirs not :-(
PLLLEASE help us ;-)
greetings marc
Not sure if this is what you are looking for. I've used the below to autofit the column to see the entire text.
Grid.DisplayLayout.Bands[0].CardSettings.AutoFit = true
Ada
Hey mike,
now I made 2 projects and remade your step-by-step.At the first project I made it exactly like you.At the second project I did not made step 10 and 11.Cause in my personal project all looks like shitty crap ^^ if I do it like you said.I copied the Codes from these two project in "Winmerge" that I can see what changed.I noticed that the Ultrawingrid save some "Layouts" of the Band (All settings included).maybe that will be the rigth way I think?
Iam very frustrated about this grid :-(greetings marc
Trying to set up a GridBagLayout in code is very difficult. You would have to understand all of the GridBagLayout properties like SpanX, SPanY, OriginX, OriginY, PreferredWidth, PreferredHeight and how all of these interact with the grid's other properties such as the width of the column.
I would recommend that you set up the grid the way you want it in the designer and then save the grid's DisplayLayout to a file. You can do this by right-clicking the grid in the designer and selecting the Layout Wizard. Then load this layout at run-time. That will be a lot easier than trying to set up the layout in code.
If you want to try setting up the layout in code, then I would recommend reading up on the concept of a GridBagLayout. I'm sure there must be lots of information about this concept on the internet. :)
Hey Mike,
Whole the day I tried this way but its very very much to configure and erverything interact with some other options.Manualy adding the Band and Columns and format them in the right style or layout is very complicated :-(As like you said to save the layout and load it at runtime is a good hint I thought it to do in the morning, too.But my chief is not for this way (Iam not, too). Because I cant control what the designer is doing there.
I'll look at the "layout-save"-way and the other and will decide in the future.
Now I want to thank you very much again! You helped me extremely!At now on I dont want to use your time longer. I think you have otherthings to do that are more important :-)
Thanks again very much!greetings Marc
Marc - I had a similar requirement and this is what I did - the result is a dynamic multiline Cell in a cardview when the Text is multiline...
1. Set the CellMultiLine to true for the CardView:
Grid.DisplayLayout.Bands[0].Override.CellMultiLine = DefaultableBoolean.True;
2. In the InitializeRow Event :
foreach (UltraGridCell cell in e.Row.Cells)
{
if (cell.Text.Contains(Environment.NewLine) && !cell.Column.Header.Caption.Contains(Environment.NewLine))
cell.Column.Header.Caption = cell.Column.Header.Caption + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine;
}
Adam
Adam,
thank you for that workaround!
Mike,
I use .NET 2007 Rel. 3 and the above mentioned workaround works fine. Is this problem solved in a newer version of the grid control?
Thanks for your reply!