Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
SummaryResultsPresenter
posted

I have been looking for an example of how to change the SummaryResultsPresenter template.  In the XamFeatureBrowser the "Custom Button In Summary Template" example has a bit that shows how to place a button in place of the default SummaryResultsPresenter.  It shows how to bind the summary results to the Tag property of a button in the SummaryResultsPresenter's ControlTemplate.  Fantastic, however if I try to adapt it to bind and show the summary results with a different control, say a restyled ItemsControl, it never actually gets the summary results bound.  What appears to be happening in the default example is that the binding to the Button's Tag property doesn't actually occur until the Click event occurs.  I don't understand why this is..  To give a sense of what I am try to do, its this:  I want to use the set of summary results to execute code that will go acquire some related data that is not loaded in the XamDataGrid and bind it to controls in a retemplated SummaryResultsPresenter.  Seems like a lot of work to get a "rich footer" on this DataGrid.  In any case, here is the snippet for the SummaryResultsPresenter Style.  Can anyone help me?

<Style TargetType="{x:Type igDP:SummaryResultsPresenter}">

     <Setter Property="FontSize" Value="14"/>

     <Setter Property="Template">

          <Setter.Value>

               <ControlTemplate TargetType="{x:Type igDP:SummaryResultsPresenter}">

 

                    <Grid>

                         <ItemsControl x:Name="SummaryItems" Visibility="Collapsed" ItemsSource="{TemplateBinding SummaryResults}" />

                         <Button x:Name="btnSummary"

                              DataContext="{Binding ElementName=SummaryItems, Path=Items}"

                              Tag="{Binding ElementName=SummaryItems, Path=Items}">

                                   Summary

                         </Button>

                        <!-- HERE IS THE ELEMENT THAT I HAVE INTRODUCED -->

                         <ListBox HorizontalAlignment="Stretch" VerticalAlignment="Stretch"

                              ItemsSource="{Binding ElementName=btnSummary, Path=Tag}" />

                    </Grid>

                    <ControlTemplate.Triggers>

                         <DataTrigger Binding="{Binding Path=Items.Count, ElementName=SummaryItems}" Value="0">

                              <Setter TargetName="btnSummary" Property="Visibility" Value="Collapsed"/>

                         </DataTrigger>

                    </ControlTemplate.Triggers>

               </ControlTemplate>

          </Setter.Value>

     </Setter>

</Style>

Parents
No Data
Reply
  • 6867
    posted

     HI,

     I tried out the template you provided, and the ListBox was populated with the summary results.  I'm not sure what the problem is that you are seeing, please let me know if you're still seeing it.

    Thanks,

    Josh

Children
No Data