I'm building a user control including a RadGridView and a RadDataPager in order to replace the default DataGrid in Visual Studio LightSwitch. I've tried this with different collections, but the DataPager does not page data. Basically only the first page is shown.
Say I've bound my control to the Products table from the Northwind database, exposed by a search screen.
This is my code:
<UserControl x:Class="HelperControls.GridControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition />
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Search:" Margin="5"/>
<TextBox Name="SearchBox" Margin="5" Width="200"/>
<Button Content="Go!" Name="SearchButton" Margin="5" Width="50"/>
</StackPanel>
<telerik:RadGridView Name="ProductsGrid" AutoGenerateColumns="False"
ShowColumnFooters="False" ShowGroupPanel="False" ItemsSource="{Binding Screen.Products}" SelectedItem="{Binding Screen.Products.SelectedItem, Mode=TwoWay}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Product Name" DataMemberBinding="{Binding ProductName}"/>
<telerik:GridViewDataColumn Header="Quantity per Unit" DataMemberBinding="{Binding QuantityPerUnit}"/>
<telerik:GridViewDataColumn Header="Unit Price" DataMemberBinding="{Binding UnitPrice, StringFormat=c}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<telerik:RadDataPager Name="RadPager1" PageSize="45" Grid.Row="2" IsTotalItemCountFixed="True" Source="{Binding ElementName=ProductsGrid, Path=Items}"/>
</Grid>
</UserControl>
The collection is corretcly bound and shown in the RadGridView, but it is not paged. The PageSize reflects the same property of the query in LightSwitch that exposes the collection; this also has paging enabled.
Thanks for any suggestions.
P.s. sorry for not formatting the code block but the result was not nice to see ;-)