I have a WPF MVVM application that uses a ContentControl on my main window to display views(UserControls). My first view has a RadGridView and a RadDataPager in it. When I try to navigate to another view I get the error: PageIndex cannot be negative when PageSize is positive. Parameter name: newPageIndex. I have commented out the RadDataPager to verify that it is part of the issue...and it is.
I believe it has something to do with the Binding. I do NOT set the PageIndex to -1 in the code.
I have included a LINK to a small sample project that repeats the issue. Can someone please tell me how to fix this.
Thanks ~Doug
I believe it has something to do with the Binding. I do NOT set the PageIndex to -1 in the code.
I have included a LINK to a small sample project that repeats the issue. Can someone please tell me how to fix this.
<telerik:RadGridView x:Name="RgvPatients" HorizontalAlignment="Stretch" VerticalAlignment="Top" HorizontalContentAlignment="Center" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" SelectionUnit="Cell" ShowGroupPanel="False" EnableRowVirtualization="False" RowIndicatorVisibility="Collapsed" IsFilteringAllowed="False" ItemsSource="{Binding Patients}" GridLinesVisibility="Horizontal" > <telerik:RadGridView.Columns> <telerik:GridViewColumn Header="MRN#" IsSortable="True"> <telerik:GridViewColumn.CellTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Button Style="{StaticResource ButtonTransparentBlackText}" VerticalAlignment="Center" Height="25" Width="100" Command="{Binding Path=SelectPatientCommand}" Content="{Binding mrn}"> </Button> </Grid> </DataTemplate> </telerik:GridViewColumn.CellTemplate> </telerik:GridViewColumn> <telerik:GridViewDataColumn Header="Last Name" DataMemberBinding="{Binding last_name}" IsReadOnly="True" TextAlignment="Left" /> <telerik:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding first_name}" IsReadOnly="True" TextAlignment="Left" /> <telerik:GridViewDataColumn Header="Middle Name" DataMemberBinding="{Binding middle_name}" IsReadOnly="True" TextAlignment="Left" /> <telerik:GridViewDataColumn Header="DOB" DataMemberBinding="{Binding dob, StringFormat='{}{0:MM/dd/yyyy}'}" IsReadOnly="True" TextAlignment="Left" /> <telerik:GridViewDataColumn Header="Age" DataMemberBinding="{Binding dob, Converter={StaticResource AgeConverter}}" IsReadOnly="True" TextAlignment="Left" /> <telerik:GridViewDataColumn Header="Gender" DataMemberBinding="{Binding Gender}" IsReadOnly="True" TextAlignment="Left" /> <telerik:GridViewDataColumn Header="Status" DataMemberBinding="{Binding adt_type}" IsReadOnly="True" TextAlignment="Left" /> </telerik:RadGridView.Columns></telerik:RadGridView><DockPanel> <telerik:RadDataPager x:Name="RdpPatients" DockPanel.Dock="Left" Width="830" NumericButtonCount="5" Height="28" DisplayMode="All" PageIndex="{Binding Path=PageData.PageIndex, Mode=TwoWay}" PageSize="20" ItemCount="{Binding Path=PageData.TotalRecords}" > <i:Interaction.Triggers> <i:EventTrigger EventName="PageIndexChanged"> <i:InvokeCommandAction Command="{Binding RdpPatients_PageIndexChangedCommand}" /> </i:EventTrigger> </i:Interaction.Triggers> </telerik:RadDataPager></DockPanel>Thanks ~Doug