使用绑定到依赖属性的 RIA 查询参数时,域数据源 CanLoad 为 false
我有一个 ria DDS 查询,其参数绑定到我的 silverlight 页面后面的代码的依赖属性。问题是,一旦项目依赖项发生更改,我就会收到以下错误。
当 CanLoad 为 false 时,无法更改 QueryParameters。更改 QueryParameters 会启动加载操作,并且当 CanLoad 为 false 时不允许加载操作。当 CanLoad 为 false 时,应禁用调用加载操作的控件。
我不知道如何完成或取消加载,因此每次从列表中选择新项目时我都可以更改项目的详细信息视图。
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my1:XT_PROJECTS, CreateList=true}" Height="0" LoadedData="ProjectDetailsDomainDataSource_LoadedData" Name="ProjectDetailsDomainDataSource" QueryName="getProjectDetails" Width="0" >
<riaControls:DomainDataSource.DomainContext>
<my:MYservices />
</riaControls:DomainDataSource.DomainContext>
<riaControls:DomainDataSource.QueryParameters>
<riaControls:Parameter ParameterName="project" Value="{Binding ElementName=ProjectDetailsPage, Path=project}" />
</riaControls:DomainDataSource.QueryParameters>
</riaControls:DomainDataSource>
public static readonly DependencyProperty projectIDDP =
DependencyProperty.Register("project", typeof(string),typeof(ProjectDetails),
new PropertyMetadata(""));
public string projectID
{
get
{
return (string)GetValue(projectIDDP);
}
set
{
SetValue(projectIDDP, value);
}
}
I have a ria DDS query whose parameter is bound to a dependency property of the code behind my silverlight page. The issue is that once the project dependency is changed I get the following error.
QueryParameters cannot be changed when CanLoad is false. Changing the QueryParameters initiates a load operation, and load operations are not permitted when CanLoad is false. Controls that invoke load operations should be disabled when CanLoad is false.
I'm at a loss on how to complete or cancel the load so I can change the details view for a project every time a new project is selected from a list.
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my1:XT_PROJECTS, CreateList=true}" Height="0" LoadedData="ProjectDetailsDomainDataSource_LoadedData" Name="ProjectDetailsDomainDataSource" QueryName="getProjectDetails" Width="0" >
<riaControls:DomainDataSource.DomainContext>
<my:MYservices />
</riaControls:DomainDataSource.DomainContext>
<riaControls:DomainDataSource.QueryParameters>
<riaControls:Parameter ParameterName="project" Value="{Binding ElementName=ProjectDetailsPage, Path=project}" />
</riaControls:DomainDataSource.QueryParameters>
</riaControls:DomainDataSource>
public static readonly DependencyProperty projectIDDP =
DependencyProperty.Register("project", typeof(string),typeof(ProjectDetails),
new PropertyMetadata(""));
public string projectID
{
get
{
return (string)GetValue(projectIDDP);
}
set
{
SetValue(projectIDDP, value);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过更多研究后,我现在非常确定您的上下文中一定有待处理的更改。在这种情况下,DomainDataSources 将“阻塞”,并且您不得对它们造成负载。
如果此错误发生在不同的情况下,我非常有兴趣对此进行纠正。
如果您有待处理的更改,您的解决方案是
After a bit more research I'm now pretty sure you must have pending changes in you context. In that case, DomainDataSources "block" and you must not cause a load for them.
If this error occurs in a different scenario, I'd be very interested to be corrected on this.
If you have pending changes, your solution is either
在更改参数之前添加提交是否有效?
像这样
Does this work adding a submit before changing the parameter?
like this