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

GridViewDataColumn Header

2 Answers 261 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 20 Jan 2015, 05:23 AM
I wish to use a TextBlock for display of a data column header.

This seems straightforward...

                    <telerik:GridViewDataColumn ColumnGroupName ="Group1" DataMemberBinding="{Binding ColumnOneBinding}" >
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Hello" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>

...however, instead of displaying 'Hello' as would be expected. The display (in both design and runtime), is 'System.Windows.Controls.TextBlock'

If this is due to an older version of the Telerik controls, is there any fix, or is the only option to purchase the new controls?

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 20 Jan 2015, 02:44 PM
Hi David,

I checked your code with older versions of RadGridView and I was not able to reproduce the issue.  I attached a sample project with the code you sent us and it is working. However, If you still experience difficulties, could you please modify it in a way that it reproduces the issue and send it back to us?

Best Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David
Top achievements
Rank 1
answered on 20 Jan 2015, 11:18 PM

Thanks Stefan, that helped to know it was something in the project, not the controls.
After some digging around, I found the source of the issue in styles.xaml...

<Style TargetType="telerik:GridViewHeaderCell">
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Margin="5" Text="{Binding}" TextWrapping="Wrap" TextAlignment="Left" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

So it had previously been overridden to default to textbox. :)

Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Stefan
Telerik team
David
Top achievements
Rank 1
Share this question
or