StringFormat not working for GridViewDataColumn header

2 posts, 0 answers
  1. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 06 May 2013 Link to this post


    <telerik:GridViewDataColumn DataFormatString="N0" DataMemberBinding="{Binding MyValue}" Header="{Binding MyLabel, StringFormat=This {0}}" />

    "This " is not shown in my header. What am I doing wrong?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 08 May 2013 Link to this post

    Hello,

    Unfortunately, you cannot format the Header that way.

    You can do it defining it like so:

    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
        <telerik:GridViewDataColumn.Header>
            <TextBlock Text="{Binding HeaderName, StringFormat='This {0}', Source={StaticResource MyViewModel}}"/>
        </telerik:GridViewDataColumn.Header>
    </telerik:GridViewDataColumn>

    I hope this helps.

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top