Datagrid仅在Silverlight中加载一个结果

时间:2011-07-11 19:16:31

标签: c# silverlight service datasource ria

我有一个为数据网格提供项目的ria domaindatasource。但是,datagrid只加载其中一个结果,并且至少返回3个结果。为什么会这样? 这是代码

            <sdk:DataGrid AutoGenerateColumns="False" IsEnabled="False" x:Name="prevSchoolDataGrid" ItemsSource="{Binding Path=Data, ElementName=gridDomainSource}" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Stretch" GridLinesVisibility="Horizontal" AlternatingRowBackground="#AD71BBFF" Margin="2,8" MinColumnWidth="100" >
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn x:Name="schoolColumn" Binding="{Binding SchoolName}" Header="School" CanUserSort="True"  />
                <sdk:DataGridTextColumn x:Name="awardColumn" Binding="{Binding Award}" Header="Award"  />
                <sdk:DataGridTextColumn x:Name="creditColumn" Binding="{Binding Credit}" Header="Credit" CanUserSort="True"  />
                <sdk:DataGridTextColumn x:Name="studyColumn" Binding="{Binding Study}" Header="Study"  />
                <sdk:DataGridTextColumn x:Name="dateAttendedColumn" Binding="{Binding DateAttended}" Header="Date Attended" IsReadOnly="True"  />
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

和域数据源

        <riaControls:DomainDataSource PageSize="50" AutoLoad="True" x:Name="gridDomainSource" QueryName="GetPreviousSchoolsQuery" VerticalAlignment="Top">
        <riaControls:DomainDataSource.DomainContext>
            <my:ApplyDataContext />
        </riaControls:DomainDataSource.DomainContext>
        <riaControls:DomainDataSource.QueryParameters>
            <riaControls:Parameter ParameterName="email" Value="{Binding Text, ElementName=EmailTB}" />
        </riaControls:DomainDataSource.QueryParameters>
    </riaControls:DomainDataSource>

1 个答案:

答案 0 :(得分:0)

原来我在传入的模型中设置了错误的数据键。所以客户端错误地绑定了。