Hi,
I'm trying to add a simple control (button) to the XamDataGrid footer. I tried to style the SummaryResultsPresenter with no luck.
Any idea how to achieve that ?
Thank you
Hello,
Thank you for contacting Infragistics. I recommend modifying the Template property for SummaryRecordPresenter style to embed a Button. But you must have a SummaryDefinition defined in the FieldLayout to allow the summary footer to appear.
eg.
<igWPF:XamDataGrid Name="xdg" DataSource="{Binding Categories}" > <igWPF:XamDataGrid.Resources> <Style TargetType="{x:Type igWPF:SummaryRecordPresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Button Height="25"></Button> </ControlTemplate> </Setter.Value> </Setter> </Style> </igWPF:XamDataGrid.Resources> <igWPF:XamDataGrid.FieldLayouts> <igWPF:FieldLayout Key="parent"> <igWPF:FieldLayout.SummaryDefinitions > <igWPF:SummaryDefinition Key="MA" SourceFieldName="Name" Calculator="Count" /> </igWPF:FieldLayout.SummaryDefinitions> </igWPF:FieldLayout></igWPF:XamDataGrid.FieldLayouts><igWPF:XamDataGrid>
Let me know if you have any questions.
Thank you Michael.
That's What I was trying to do originally but I was missing the summary definition.
This solution doesn't work for me since I'm trying to make this style a global resource available for the XamDataGrids to use.
Thank you for following up. You can move the style higher up to the container's resources or the window, which ever you prefer. It should behave the same way as if it were placed in a single grid instance.
<Window.Resources>
<Style TargetType="{x:Type igWPF:SummaryRecordPresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Button Height="25"></Button> </ControlTemplate> </Setter.Value> </Setter> </Style>
</Window.Resources>
Michael,
I'm not using this button to display or generate sums or counts. I'm using this button as a command button that will start a certain process.
Using this method requires a Summary Definition for each grid.
Summares do not need to be enabled or added to utilize this approach but it is considered a work around since there isn't a footer. I recommend modifying the grid's default template to customize your own footer area or use a UserControl to extend the XamDataGrid.
I recommend modifying the XamDataGrid's default style to add your button without neededing a summary definition. You can create your own custom control template based on the styles in the following location.C:\Program Files\Infragistics\NetAdvantage 20xx.x\WPF\DefaultStyles\DataPresenter