Setting TextAlignment of GridViewExpressionColumn at Runtime

3 posts, 0 answers
  1. David
    David avatar
    8 posts
    Member since:
    Jun 2015

    Posted 13 Jan Link to this post


    I'm attempting to set the TextAlignment property of a GridViewExpressionColumn at runtime. The property is set correctly but the change is not reflected in the grid. The same change to a GridViewDataColumn works as I would expect - the alignment is set visually on the screen straight away.

    var col = this.RadGridView.Columns[0];
    col.TextAlignment = TextAlignment.Right;


    I have found that it the column is removed and re-inserted it will work correctly:

    var col = this.RadGridView.Columns[0];
    col.TextAlignment = TextAlignment.Right;
    this.RadGridView.Columns.Insert(0, col);



    Is this a bug? Or am I missing something?







  2. Martin Ivanov
    Martin Ivanov avatar
    2647 posts

    Posted 18 Jan Link to this post

    Hello David,

    This is an issue with the GridViewExpression column. I've logged it in the feedback portal where you can track its status. Also, you can find your Telerik points updated.

    To work this around, you can define a CellTemplate for the column and set the TextAlignment property in the element inside the template. For example:

    		<TextBlock Text="{Binding}" 
    				   TextAlignment="{Binding RelativeSource={RelativeSource AncestorType=telerik:GridViewCell}, Path=Column.TextAlignment}"  />

    You can also check the attached project. I hope this helps.

    Martin Ivanov
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at

  3. David
    David avatar
    8 posts
    Member since:
    Jun 2015

    Posted 26 Jan Link to this post

    Thanks, Martin.
Back to Top