GridViewDataColumn Header

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

    Posted 19 Jan 2015 Link to this post

    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. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 20 Jan 2015 Link to this post

    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.

     
  3. David
    David avatar
    3 posts
    Member since:
    Jan 2015

    Posted 20 Jan 2015 in reply to Stefan Link to this post


    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. :)

Back to Top