Silverlight 3 – RIA Services

I started playing with the beta bits of the RIA Services and started to create a simple app, where list of customers will be displayed in a DataGrid  and a page size of 10 and will be edited using DataForm.

This is the XAML I had

<UserControl xmlns:dataControls=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm”  xmlns:data=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”  x:Class=”SilverlightApplication10.MainPage”
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml
             xmlns:riaControls=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls”
             xmlns:riaData=”clr-namespace:System.Windows.Data;assembly=System.Windows.Ria.Controls”
             xmlns:domain=”clr-namespace:SilverlightApplication10.Web”
    Width=”800″ Height=”600″>
    <Grid Margin=”10″ x:Name=”LayoutRoot” Background=”White”>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <riaControls:DomainDataSource x:Name=”source” LoadSize=”100″   LoadMethodName=”LoadCustomers” AutoLoad=”True”>
            <riaControls:DomainDataSource.DomainContext>
                <domain:NorthwindContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <StackPanel>
             <dataControls:DataPager PageSize=”10″   Source=”{Binding Data, ElementName=source}” />
        <data:DataGrid x:Name=”datagrid1″ ItemsSource=”{Binding Data, ElementName=source}” IsReadOnly=”True” AutoGenerateColumns=”False” >
            <data:DataGrid.Columns>
                <data:DataGridTextColumn Header=”Customer ID” Binding=”{Binding CustomerID}”/>
                <data:DataGridTextColumn  Header=”Contact Name” Binding=”{Binding ContactName}”/>
                <data:DataGridTextColumn  Header=”Contact Title” Binding=”{Binding ContactTitle}”/>
            </data:DataGrid.Columns>
        </data:DataGrid>
        </StackPanel>       
            <!–<dataControls:DataForm WrapAfter=”4″ AutoEdit=”True”     Header=”Customer Details”  CurrentItem=”{Binding ElementName=datagrid1, Path=SelectedItem}” Grid.Row=”1″></dataControls:DataForm>–>
      
    </Grid>
</UserControl>

ria1

everything  looks good,  clicked the button in the pager to go to the lastpage, there are only 91 records, so not sure if the pager is displaying loadsize/pagesize as number of pages, but I get this. cannot go to the first page. looks like it knows there are is no data in Page 10, and but the UI is not reflecting that.  if we click the next button in the pager we go to 2nd page

ria2

When the loadsize is specified to something less than 91 (say 30), I can see data for 3 pages but when I navigate to 4th page, I dont  get data

I uncommented the DataForm and ran the sample

ria3

I noticed the following

1. Pager functionality not there

2. AutoEdit  on the DataForm is set to true, so it goes into edit mode and displays Save and Cancel buttons. Cancel is grayed out and it shows there are some pending changes. if we select another Item in the datagrid everything is good.

3. If I remove the AutoEdit  on DataForm  pager seems to work, but when I go to next page, Datagrid doesnt select the first item by default so the DataForm is empty

Leave a comment