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
330
Word Wrap and Truncation in UltraGrid Header
posted

Hi,

 I am adding dynamic column to ultragrid. I have set the Width and height as below.

bgCandE.DisplayLayout.Override.DefaultRowHeight = 50;

bgCandE.DisplayLayout.Override.DefaultColWidth = 200;

and enable word wrapping and truncation using the below code in the

ultragrid InitializeLayout event.

 

ugCol.CellMultiLine =

DefaultableBoolean.True;

ugCol.Band.Columns[ugCol.Key].CellMultiLine =

DefaultableBoolean.True;

 

1) Word Wrapping and truncation is not happening for Column Header.How to achieve word wrapping and truncation in the dynamic column header.

2) For the above set column height and width ,it display three rows and truncation happens. If value in the cell is small whcih fits for the only one line,it always displays height of three rows but i want don't want to display the blank row in the cell.

 

   If it has value for one row,then only one row has to be displayed which no blank row.If it has the value for two rows,then two rows has to be displayed which no blank row. if it has three or more rows,truncation should happen and display three rows only.

 

  How to achieve this.

Thanks in advance

Regards

Vijay A

 

Parents
  • 469350
    Offline posted

    Hi Vijay,

    a_vijay said:

    ugCol.CellMultiLine =

    DefaultableBoolean.True;

    ugCol.Band.Columns[ugCol.Key].CellMultiLine =

    DefaultableBoolean.True;

    Are you aware that these two lines of code are exactly the same? You are setting the same property on the same column twice.

    a_vijay said:
    1) Word Wrapping and truncation is not happening for Column Header.How to achieve word wrapping and truncation in the dynamic column header.

    CellMultiLine only affects the cells. For the column header, you will want to do something like this:

    e.Layout.Override.WrapHeaderText = DefaultableBoolean.True;

    a_vijay said:

    2) For the above set column height and width ,it display three rows and truncation happens. If value in the cell is small whcih fits for the only one line,it always displays height of three rows but i want don't want to display the blank row in the cell.

     

       If it has value for one row,then only one row has to be displayed which no blank row.If it has the value for two rows,then two rows has to be displayed which no blank row. if it has three or more rows,truncation should happen and display three rows only.

    I'm not entirely sure I understand your question, but it sounds like you want the grid rows to automatically adjust their height based on the contents of the row. The grid row heights are synchronized by default so they all have to be the same height. To allow the heights to vary, you have to set the RowSizing property to one of the "Free" settings. In your case, you probably want this:

    e.Layout.Override.RowSizing = RowSizing.AutoFree;

     

     

Reply Children