How to bind dataset from web service to datagrid of wpf
My question is how to bind data which is stored in Microsoft SQL Server 2008 and return as dataset in the web service (the database and web service are from remote computer) to the datagrid control in wpf application. In the xaml.cs file how can I retrieve the dataset that return from web service and bind to datagrid? Can give me some examples?
In the xaml.cs file i need to declare a new dataset?
DataSet ds = new DataSet();
how can I bind the retrieved dataset from web service for example getQue() to the dataset above? how to bind the dataset to the datagrid of wpf?
Please guide me. Thanks in adv开发者_开发知识库ance.
Basically you need to put this in your XAML
<Grid>
<dg:DataGrid ItemsSource="{Binding}"/>
</Grid>
And this in your code
this.DataContext = dataset.Customers.DefaultView;
There is a pretty good example how to achieve all that and more -see http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx
精彩评论