We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Alignment of a column in the grid

Hello,

I want to align a column to right and find no solution.

My code:

With MyMultiColumnList
  .DataSource = MyDataSet.Tables("MyTable")
  .DisplayMember = "ColumnName01"
  .ValueMember = "ColumnName02"
  AddHandler .ListBox.Grid.QueryCellInfo, AddressOf Grid_QueryCellInfo
  .ListBox.Grid.ColStyles.Item("ColumnName01").TextAlign = GridTextAlign.Right
End With

Have you an idea?

Best regards,
Frank

3 Replies

SK Senthil Kumaran Rajan Syncfusion Team January 27, 2016 06:54 AM UTC

Hi Frank,

Thanks for contacting Syncfusion Support.

The reported requirement can be achieved by handling the QueryCellInfo event of the GridListBox in MultiColumnComboBox. Please make use of the below code example.

Code Example[VB]:

  Private Sub Model_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)

            'To Align only the first column.

            'If e.RowIndex = 0 And e.ColIndex = 1 Then

            'To Align the columnHeader Of MultiColumnCombobox

            If e.RowIndex = 0 Then

                e.Style.HorizontalAlignment = GridHorizontalAlignment.Right

                e.Style.TextColor = Color.Red

            End If

        End Sub


We have prepared a sample for your reference and it can be downloaded from here.

Sample : http://www.syncfusion.com/downloads/support/forum/121795/ze/MultiColumnHeaderAlign-1727209248


Also, refer to the following screenshot.


Regards,
Senthil


FP Frank Piplak January 27, 2016 10:42 AM UTC

Hello Senthil,

works fine, thank you.

Best regards,
Frank


SK Senthil Kumaran Rajan Syncfusion Team January 27, 2016 11:15 AM UTC

Hi Frank,

Thank you for your update.

We are glad to know that, your requirement has been achieved. Please let us know if you need any further assistance, we will be happy to assist you.

Regards,
Senthil

Loader.
Up arrow icon