Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
Setting CellMultiLine True Breaks TextVAlign Settings
posted

I have a grid on a form that i want to wrap long text and i want all cell text to be aligned vertically in the middle.

When CellMultiline is off, cell text is not wrapped but the text is aligned in the middle.

When CellMultiline is on, text fields are vertically aligned top at the top, while date fields correctly align in the middle.

I have only the following properties set in my test:

InitLayout
 e.Layout.Override.CellAppearance.TextVAlign = VAlign.Middle;
Checkbox event
 if (checkBox1.Checked)  ultraGrid1.DisplayLayout.Override.CellMultiLine = DefaultableBoolean.True;  else  ultraGrid1.DisplayLayout.Override.CellMultiLine = DefaultableBoolean.Default;

Any ideas? Bug?

Here are screen shots: I can upload the simple sample if desired.

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    This behavior is intentional.

    The reason for this is that when you go into edit mode on a cell in the grid, the grid uses a TextBox control to display the text and allow editing. But the Microsoft TextBox control does not support both multiline and aligning the text to the middle or bottom.

    Since this would be jarring for a user to have the text jump to the top of the cell when the cell goes into edit mode, the grid does not allow you to align the text anywhere but the top when using Mutliline for the sake of consistency.

    If your cells are not editable, or you don't care about the jumping text, then you can work around this very easily using a DrawFilter.

    There is a discussion about this same issue, and a sample DrawFilter, here:

    Workaround on Appearance.TextVAlign Property - Infragistics Community

Children
No Data