This project is read-only.

How can right align extended datagrid columns

Apr 8, 2014 at 7:42 PM
I am using VS 2008. Creating some ExtendedGrid.ExtendedColumn.ExtendedDataGridTextColumn columns programmatically. How can I right align the contents in the columns.
Apr 8, 2014 at 8:39 PM
Try this (example shown if for datagrid (use ExtenDatagrid)

                <Grid Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <TextBlock HorizontalAlignment="Right" Text="{Binding Path=ImpaId}"/>
Apr 8, 2014 at 8:46 PM
Edited Apr 8, 2014 at 8:48 PM
Thanks. But I am looking a way to do it programmatically. Following is my code:
        var columns = dsRequest.Tables[0].Columns;
        foreach (DataColumn col in columns)
                 var column = new ExtendedGrid.ExtendedColumn.ExtendedDataGridTextColumn
                    Header = col.ColumnName,
                    Binding = new Binding(col.ColumnName),
How can I specify HorizontalAlignment.Right for the above column? Tried the following code. But getting an error.
                 column.CellStyle.Setters.Add(new Setter(ContentControl.HorizontalAlignment, HorizontalAlignment.Right));
Apr 8, 2014 at 9:22 PM
DataGridTextColumn MyColumn = new DataGridTextColumn();
MyColumn.Header = "Test";
MyColumn.Binding = new Binding("Sample");

Style style = (Style)m_DataGrid.Resources["ColumnGone"];
MyColumn.CellStyle = style;