Hi,
I use readonly grid just to preview data and I need to disable multiline in order to make grid cell's content align vertically middle.
Is there any way to display cell's content vertically middle and not cut it when it reaches right cell border?
Regards,
Hello,
It seems that the CellDisplayStyle was the thing I was missing in my code. Thank you for your valuable answer.
Best regards,
I beleive this posts asks (and answers) the same question.
Workaround on Appearance.TextVAlign Property - Infragistics Community
When the CellDisplayStyle is set to default, the multi-line text will always top align. Below is a snippet that should get the alignment working for you.
ultraGrid1.DisplayLayout.Bands[0].Override.CellAppearance.TextHAlign = HAlign.Center; ultraGrid1.DisplayLayout.Bands[0].Override.CellAppearance.TextVAlign = VAlign.Middle; ultraGrid1.DisplayLayout.Bands[0].Override.CellMultiLine = DefaultableBoolean.True; ultraGrid1.DisplayLayout.Bands[0].Override.CellDisplayStyle = CellDisplayStyle.FormattedText; //or PlainText
The last line of code is the magic. Set that to FormattedText or PlainText and you should see everything align up properly.
I do not want to disable multi line. I need to position the text in each cell middle and use multi line at the same time. Please take a look at attached screenshot.
As you can see there are three columns (no 3, 5 and 9) where the multi line option is used and they are not centered vertically even I tried using mentioned lines (your previous post). It just didn't worked.
We expect the data to be centered vertically. Is there another way to fix this issue?
If you want to disable or enable multiline of a grid you should set ultraGrid1.DisplayLayout.Override.CellMultiLine to DefaultableBoolean.False or DefaultableBoolean.True.
If you want to determine the align of the text in cells then you should use :
ultraGrid1.DisplayLayout.Override.CellAppearance.TextHAlign = HAlign.Center;
ultraGrid1.DisplayLayout.Override.CellAppearance.TextVAlign = VAlign.Middle;
let me know if you have any further questions.