如何通过从Silverlight调用WCF根据第一个组合框选择显示数据 [英] How to display data according to first combobox selection by calling WCF from Silverlight
本文介绍了如何通过从Silverlight调用WCF根据第一个组合框选择显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我从组合框中选择项目时如何调用wcf.我必须根据所有组合框选择在dataGrid中显示项目.
我的WCF像下面这样:
How to call wcf as I select item from comboboxes.I have to display items in dataGrid according to all combobox selection.
My WCF is like bellow:
[OperationContract]
public IEnumerable<eventdetail> GetEvents(EventQuery query)
{
return new List<eventdetail>()
{
new EventDetail(){ Id=1, Description="Scan Complete: Threats: 0 Scanned: 1274062 Files/Folders/Drives Omitted: 39",Type= EventType.Error, User="Local Account", Computer="INRG0081", CreationTime=DateTime.Now, EventId="10115", Source="SQL Server"},
new EventDetail(){ Id=2, Description="Scan Complete: Threats: 0 Scanned: 1274062 Files/Folders/Drives Omitted: 39",Type= EventType.Error, User="Local Account", Computer="INRG0081", CreationTime=DateTime.Now, EventId="10115", Source="SQL Server"},
}
}
public class EventQuery
{
public LogType logType { get; set; }
public EventType Type { get; set; }
public string Source { get; set; }
public string EventId { get; set; }
public DateTime CreationTimeStart { get; set; }
public DateTime CreationTimeEnd { get; set; }
public string User { get; set; }
public string Computer { get; set; }
public string Description { get; set; }
public int MaxMatches { get; set; }
}
public class EventDetail
{
public int Id { get; set; }
public EventType Type { get; set; }
public DateTime CreationTime { get; set; }
public string Source { get; set; }
public string EventId { get; set; }
public string User { get; set; }
public string Computer { get; set; }
public string Description { get; set; }
}</eventdetail></eventdetail>
How to achieve that?
推荐答案
Luck2写道:
如何将wcf称为我从组合框中选择项目.我必须根据所有组合框选择在dataGrid中显示项目.
How to call wcf as I select item from comboboxes.I have to display items in dataGrid according to all combobox selection.
您的问题不是很清楚.
但是,据我了解,您可以根据在组合框中选择的内容来过滤数据网格.请参见此处 [
Your question is not very clear.
However, from what I understand you can filter your datagrid based on what you select in the combo box. See here [^] for a sample.
combobox包含选定项"属性,将该属性强制将其转换为eventdetail对象,然后发送给WCF:)
combobox contain Selected Item property cast that one to your eventdetail object and and send to the WCF :)
这篇关于如何通过从Silverlight调用WCF根据第一个组合框选择显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文