This is a migrated thread and some comments may be shown as answers.

StringFormat not working for GridViewDataColumn header

1 Answer 287 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kristoffer
Top achievements
Rank 1
Kristoffer asked on 06 May 2013, 10:53 AM

<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?

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 08 May 2013, 08:57 AM
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.

Tags
GridView
Asked by
Kristoffer
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or