Hi Team,
I am working on the Xam Grid control. Xam grid Contains a custom pager with some styles.
When a group by is done on the parent grid control. All the child grid controls formed as a result of group by is also inheriting the parent pager settings.
I dont want the parent pager styles to the child. I tried in the following way to remove the styles. But the it is applying for both the child and parent.
<igGrid:XamGrid HorizontalAlignment="Stretch" Grid.Row="1" x:Name="igGrid" AutoGenerateColumns="False" Loaded="igGrid_Loaded" GroupByCollectionChanged="igGrid_GroupByCollectionChanged" >
private void igGrid_GroupByCollectionChanged(object sender, GroupByCollectionChangedEventArgs e) { var childgrid= sender as XamGrid; if (e.NewGroupedColumns.Count > 0) { childgrid.GroupBySettings.GroupByColumns.Grid.PagerSettings.AllowPaging = PagingLocation.None; //((XamGrid)childgrid.GroupBySettings.GroupByColumns.Grid.Parent).PagerSettings.AllowPaging = PagingLocation.Bottom; } childgrid.PagerSettings.AllowPaging = PagingLocation.Bottom; }
Is there any way that it can be done only the child grids?
Hi Manoj,
Pager settings can be set on a per ColumnLayout fashion but when you groupby columns, rows under each grouping are not considered as child rows since they still use the same ColumnLayout as they did without the groupby. In order to hide the pager stuff for grouped rows you'll need to use a style on the PagerCellsPanel which hides it. Something like this:
<Style TargetType="{x:Type ig:PagerCellsPanel}"> <Setter Property="Visibility" Value="Collapsed"/> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Row.Manager.ParentRow}" Value="{x:Null}"> <Setter Property="Visibility" Value="Visible"/> </DataTrigger> </Style.Triggers> </Style>
Hi Rob,
Thanks for the quick reply. I Tried your solution in my silverlight project but i am not able to get the thing done.
I have created sample poc for your reference. If you can replicate the behaviour of our code in my sample it would be great.
sample code: http://1drv.ms/1SQhBYs
Regards,
manoj
I tried the code. But unfortunetly it did not worked.
It looked like to work because of the following line:
<igGrid:PagerSettings AllowPaging="Bottom" PageSize="3" Style="{StaticResource childStyle}"/>
So it started showing same line for parent and child. I have updated the code further and kept only one Parent style which should be applied.
If you can make the below code working that would be great
reference Code: http://1drv.ms/1T9yzkV
I actually found a better way to handle this. Instead of using the RowExpansionChanged event and trying to force the style to change I created a set of attached properties that allow you to set what templates you want to use for parent pagers and child pagers. So now you just need to create an implicit style for PagerCellControl in your XAML and setup these attached properties. Take a look at the updated sample I attached for more info.
I am not able to run the solution. I am getting the below exception on load of the view.
The property 'ParentPagerTemplate' was not found in type 'Infragistics.Controls.Grids.Primitives.PagerCellControl'.
InnerException is null
I only see that exception if I comment out the PagerTemplateChanger class I added to MainPage.xaml.cs. If you are running the sample I attached as is, with no changes, then it should work because the class is there. I just redownloaded the sample and ran it on a virtual machine I made running VS2010 with SL5 installed. The sample ran as expected and the pager templates were applied.
Hi Kumar,
Were you able to get this working? Let me know if you have any further questions.