Try to create a custome pager for Xamgrid. What I did as bellow:1. Create a style like: <Style x:Key="TestPager" TargetType="gridPrim:PagerCellControl" > <Setter Property="Template"> <Setter.Value > <ControlTemplate TargetType="gridPrim:PagerCellControl"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" > <StackPanel Orientation="Horizontal"> <Button x:Name="TestButton" Margin="25,0,5,0" Padding="2" Height="20" > <Button.Content> <Image Source="MyTest.png" Height="16" Cursor="Hand" /> </Button.Content> <ig:Commanding.Command> <common:TestCommandSource EventName="Click"/> </ig:Commanding.Command> </Button > <TextBlock Text="Page Size:" Margin="15,8,5,0"></TextBlock> ...... </StackPanel> <gridPrim:PagerControl x:Name="PagerItemControl"> <ig:Commanding.Commands> <ig:XamGridPagingCommandSource EventName="FirstPage" CommandType="FirstPage"/> <ig:XamGridPagingCommandSource EventName="LastPage" CommandType="LastPage"/> <ig:XamGridPagingCommandSource EventName="PreviousPage" CommandType="PreviousPage"/> <ig:XamGridPagingCommandSource EventName="NextPage" CommandType="NextPage"/> <ig:XamGridPagingCommandSource EventName="GoToPage" CommandType="GoToPage" /> </ig:Commanding.Commands> </gridPrim:PagerControl> </StackPanel> </ControlTemplate> </Setter.Value> </Setter > </Style>2. Create XamGrid in user control testing the pager with following Settings: <ig:XamGrid.RowSelectorSettings> <ig:RowSelectorSettings x:Name="rowSelectorSettings" Visibility="Visible" /> </ig:XamGrid.RowSelectorSettings> <ig:XamGrid.FilteringSettings> <ig:FilteringSettings AllowFiltering="FilterRowTop" IsMouseActionEditingEnabled="SingleClick" FilteringScope="ColumnLayout"/> </ig:XamGrid.FilteringSettings> <ig:XamGrid.PagerSettings> <ig:PagerSettings AllowPaging="top" Style="{StaticResource TestPager}" /> </ig:XamGrid.PagerSettings> <ig:XamGrid.ClipboardSettings> <ig:ClipboardSettings AllowCopy="True" AllowPaste="True"/> </ig:XamGrid.ClipboardSettings> <ig:XamGrid.SortingSettings> <ig:SortingSettings AllowMultipleColumnSorting="True" /> </ig:XamGrid.SortingSettings> <ig:XamGrid.ColumnMovingSettings> <ig:ColumnMovingSettings AllowColumnMoving="Indicator"/> </ig:XamGrid.ColumnMovingSettings> <ig:XamGrid.SelectionSettings> <ig:SelectionSettings CellSelection="Multiple" ColumnSelection="Multiple" RowSelection="Multiple" CellClickAction="SelectRow" /> </ig:XamGrid.SelectionSettings> <ig:XamGrid.ColumnChooserSettings> <ig:ColumnChooserSettings AllowHideColumnIcon="True" AllowHiddenColumnIndicator="True"></ig:ColumnChooserSettings> </ig:XamGrid.ColumnChooserSettings> <ig:XamGrid.ColumnResizingSettings> <ig:ColumnResizingSettings AllowColumnResizing="Indicator" AllowMultipleColumnResize="True" AllowCellAreaResizing="True" AllowDoubleClickToSize="True" /> </ig:XamGrid.ColumnResizingSettings> <ig:XamGrid.ConditionalFormattingSettings> <ig:ConditionalFormattingSettings AllowConditionalFormatting="True" /> </ig:XamGrid.ConditionalFormattingSettings> <ig:PersistenceManager.Settings> <ig:PersistenceSettings SavePersistenceOptions="AllButIgnored" LoadPersistenceOptions="AllButIgnored"> <ig:PersistenceSettings.PropertySettings> <ig:PropertyNamePersistenceInfo PropertyName="Columns[].FilterColumnSettings" Options="Contains"/> </ig:PersistenceSettings.PropertySettings> </ig:PersistenceSettings> </ig:PersistenceManager.Settings>3. Binding for ItemSoutce of XamGrid is PagedCollectionView in view model:in VM:public PagedCollectionView DataList { get; set; }in Xaml:ItemsSource="{Binding DataList}" 4. Run the app with no data, click on the button in pager: first click will do nothing but move the mouse cursor to the filter line in XamGrid, second click will call the command assoicated with the button.5. If there is try to test this case with Restore persistence, when Usercontrol UI is loaded with no data, the header line of XamGrid lost and may crash tha app.So looks like if there is no data for XamGrid, there is a lot of problem. How to fix it so that it working well for different situation?
Hi Ben,
I'm going to place your code into a sample and test out your steps to try and reproduce this. I'll let you know the results when I have them.
The reason for the behavior you see in #4 is because you have IsOnCellActiveEditingEnabled set to true. When this property is true and a cell in the filter row is made the active cell, it is automatically thrown into edit mode. Since there is no data the only cells in the grid are the filter row cells so one of them is made the active cell when the grid gets focus. To resolve this you should default the IsOnCellActiveEditingEnabled property to false and when you finally have data loaded set it back to true if you want.
<ig:XamGrid.FilterSettings> <ig:FilterSettings IsOnCellActiveEditingEnabled="False"/> </ig:XamGrid.FilterSettings>
For #5, what do you mean by header line of the XamGrid is lost? What header line are you referring to?