从代码隐藏中使用 RIA 服务 FilterDescriptor
我想知道是否可以从后面的代码使用 FilterDescriptor 控件?
在表单的页面加载中,我在后面的代码中设置了网格的数据源,而不是使用 DomainDataSource 控件,例如:
TestDomainContext context = new TestDomainContext();
dataGridEmployees.ItemsSource = context.EmployeePositions;
context.Load(context.GetEmployeesWithPositionQuery());
我的页面上有一个文本框,用户可以输入该文本框来过滤员工职位。
现在是否可以在代码后面将 FilterDescriptor 添加到 DataGrid 的源中?或者我是否需要手动过滤 context.GetEmployeesWithPositionQuery 的结果,例如过滤器 TextBox 的 KeyUp 事件?
I was wondering if it's possible to use the FilterDescriptor control from code behind?
On the page load of my form I set the datasource of a grid in the code behind, not using a DomainDataSource control, like:
TestDomainContext context = new TestDomainContext();
dataGridEmployees.ItemsSource = context.EmployeePositions;
context.Load(context.GetEmployeesWithPositionQuery());
I have a textbox on my page that the user can enter into to filter on employee position.
Is it now possible to add FilterDescriptor to the source of the DataGrid in code behind? Or would I manually need to filter the results of the context.GetEmployeesWithPositionQuery, for example on KeyUp event of the filter TextBox?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它对我有用如下。
您可以添加 DomainDataSource,但从代码后面控制它,而不是在 xaml 中声明:
然后,正如我在 在代码中设置 FilterDescriptor - C# Silverlight 4 WCF,您可以在代码后面创建一个 FilterDescriptor 并将其添加到您的 DDS:
希望这有帮助,
翻转
It worked for me as follows.
You can add a DomainDataSource but control it from code behind instead of declarative in xaml:
Then, as I read in Set FilterDescriptor in code - C# Silverlight 4 WCF, you can create a FilterDescriptor in code behind and add it to your DDS:
Hope this helps,
flip