Datagrid Header Text Binding Issues

2 posts, 0 answers
  1. Muralidharan
    Muralidharan avatar
    2 posts
    Member since:
    Jan 2013

    Posted 01 Sep Link to this post

    On trying to Bind the Header Text for the Datagrid columns fails to bind, 

    telerikGrid:DataGridDateColumn Header="{Binding DateHeader}" x:Name="colGridDate" PropertyName="TestDateTime" gets filled with the property name instead of the DateHeader in the View Model.

    While defining the header as

                                <TextBlock Text="{Binding DateHeader}">

    also doesnt bind the value, whereas on Harding the Text. It displays it in the UI.(TextBlock Text="Date").

    Kindly help me in binding the value from my view model.


  2. Patrick
    Patrick avatar
    150 posts

    Posted 01 Sep Link to this post

    Hello Muralidharan,

    The DataContext of the Header is the column itself (in your case, its a DataGridDateColumn), so you need to set your binding to point towards the view model. For example, use an ElementName binding or x:Bind (e.g. Text="{Binding DataContext.DateHeader, ElementName=MyPage}" ). 

    I've attached a project which illustrates the DataContext of the TextBlock.

    I hope this clears things.

    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top