Style DataTrigger on column aggregate

3 posts, 1 answers
  1. Art Kedzierski
    Art Kedzierski avatar
    107 posts
    Member since:
    Nov 2009

    Posted 04 Nov 2010 Link to this post

    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. Answer
    Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 09 Nov 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Art Kedzierski
    Art Kedzierski avatar
    107 posts
    Member since:
    Nov 2009

    Posted 12 Nov 2010 Link to this post

    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!
Back to Top