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

Style DataTrigger on column aggregate

2 Answers 216 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Art Kedzierski
Top achievements
Rank 2
Art Kedzierski asked on 04 Nov 2010, 01:23 PM
I can't seem to figure out how to style a component in an aggregate footer. I have a Style with a DataTrigger that works just fine for the RadProgressBar in a cell, but is completely useless when applies to the footer (see picture). What would be the correct methodology?

<telerik:GridViewDataColumn UniqueName="Status"
                            Header="Status"
                            DataMemberBinding="{Binding Status}"
                            DataType="{x:Type sys:Int32}"
                            Width="200"
                            HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"
                            CellStyle="{StaticResource GridViewCellStyle1}"
                            FooterCellStyle="{StaticResource GridViewFooterCellStyle1}"
                            HeaderTextAlignment="Center"
                            TextAlignment="Center"
                            FooterTextAlignment="Center">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <Grid>
                <telerik:RadProgressBar Style="{StaticResource RadProgressBarStyle1}"
                                        Value="{Binding Path=TSE_Status}"
                                        Minimum="0"
                                        Maximum="100"
                                        Grid.Column="0"
                                        Grid.Row="0" />
                <TextBlock Text="{Binding Path=Status, StringFormat={}{0:N0}%}"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Center"
                           Grid.Column="0"
                           Grid.Row="0" />
            </Grid>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
    <telerik:GridViewDataColumn.AggregateFunctions>
        <telerik:AverageFunction />
    </telerik:GridViewDataColumn.AggregateFunctions>
    <telerik:GridViewDataColumn.Footer>
        <telerik:AggregateResultsList ItemsSource="{Binding}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <telerik:RadProgressBar Style="{StaticResource RadProgressBarStyle1}"
                                                Value="{Binding FormattedValue, Mode=OneWay}"
                                                Minimum="0"
                                                Maximum="100"
                                                Grid.Column="0"
                                                Grid.Row="0" />
                        <TextBlock Text="{Binding FormattedValue, Mode=OneWay, StringFormat={}{0:N0}%}"
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Center"
                                   Grid.Column="0"
                                   Grid.Row="0" />
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </telerik:AggregateResultsList>
    </telerik:GridViewDataColumn.Footer>
</telerik:GridViewDataColumn>

2 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 09 Nov 2010, 12:00 PM
Hello Art,


Unfortunately I was not able to reproduce the issue using your snippet. Attached is an example based on it and let me know how it differs from yours.

Feel free to modify it and sent it back to me if you have any difficulties.

Regards,
Vanya Pavlova
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Art Kedzierski
Top achievements
Rank 2
answered on 12 Nov 2010, 04:46 PM
That fixed it. The answer in your code was having separate styles with different DataTriggers for Cell and AggregateFooter: 

  • For cell:
    <DataTrigger Value="x" Binding="{Binding column}">
  • For aggregate footer:
    <DataTrigger Value="x" Binding="{Binding FormattedValue}">
Thanks!
Tags
GridView
Asked by
Art Kedzierski
Top achievements
Rank 2
Answers by
Vanya Pavlova
Telerik team
Art Kedzierski
Top achievements
Rank 2
Share this question
or