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

DataGridTemplateColumn CellContentTemplate

1 Answer 164 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
Andres
Top achievements
Rank 1
Andres asked on 03 Feb 2020, 11:02 PM
<telerikGrid:DataGridTemplateColumn
                        CanUserSort="True"
                        HeaderText="%">
                        <telerikGrid:DataGridTemplateColumn.SortDescriptor>
                            <common:PropertySortDescriptor PropertyName="UnitsPercentage" />
                        </telerikGrid:DataGridTemplateColumn.SortDescriptor>
                        <telerikGrid:DataGridTemplateColumn.HeaderStyle>
                            <telerikGrid:DataGridColumnHeaderStyle
                                BackgroundColor="Transparent"                                    
                                TextFontAttributes="Bold"
                                HorizontalTextAlignment="Center"
                                OptionsButtonText=" "
                                TextFontSize="30"
                                IndicatorColor="{StaticResource DarkBlueColor}"/>
                        </telerikGrid:DataGridTemplateColumn.HeaderStyle>

                        <telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                            <DataTemplate>                                    
                                <Grid
                                    BackgroundColor="{Binding UnitsPercentage, Converter={StaticResource PercentColorConverter}}"
                                    Margin="5"
                                    Padding="10">
                                    <Label
                                        FontAttributes="Bold"
                                        Margin="0, 5, 0, 5"
                                        HorizontalOptions="Center"
                                        Text="{Binding UnitsPercentage, StringFormat='{0:N2}'}"
                                        TextColor="White"
                                        VerticalTextAlignment="Center"/>
                                </Grid>                                        
                            </DataTemplate>
                        </telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                    </telerikGrid:DataGridTemplateColumn>

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 05 Feb 2020, 11:48 AM

Hi Andres,

This is due to the used ColumnHeaderStyle of the TemplatedColumn - the style has a transparent background, that's why the button is seen when goes below it.  To resolve it you can either remove the BackgroundColor or set it to the same gray background as in the other column headers.

Let me know if I can assist with anything else.

Regards,
Yana
Progress Telerik

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
Tags
DataGrid
Asked by
Andres
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or