Silverlight at Visual Studio 2010 sample for simple binding a data to DataGrid. This sample is also for the beginners only. We will create a Databinding for DataGrid in a simple way using WCF and Linq to SQL.
For more details: http://docs.google.com/Doc?docid=0AQNzLAfQzOoaZGZrc25tY3BfMWhzMno3c2c4&hl=en
Great tutorial. I had two issues.
ReplyDelete1. I had to add 'using SimpleGridBinding.StudentService;' to MainPage.xaml.cs.
2. I had to change the AutoGenerateColumns property from 'False' to 'True' on MainPage.xaml.
Again, the Autocomplete tutorial was good, but you were even more careless with your "beginners only" code.
ReplyDeleteThe first five issues listed here make your example worthless to a beginner.
1. I had to add 'using System.Windows.Input;' to MainPage.xaml.cs for KeyEventArgs.
2. I had to add '[OperationContract] List GetListByName(string name);' to IService1.cs
3. I had to add the code below to Service1.svc.cs.
public List GetListByName(string name)
{
DataClasses1DataContext db = new DataClasses1DataContext();
var q = from studentList in db.Students
where studentList.Name.Contains(name)
select studentList;
return q.ToList();
}
4. I had to change
'c.GetListByNameCompleted +=new EventHandler(c_GetListByNameCompleted);'
in MainPage.xaml.cs (autoCompleteBox1_KeyUp method) to
'c.GetListByNameCompleted += new EventHandler(c_GetListByNameCompleted);'
before the project would compile.
5. The 'Load Data' button from the first tutorial was removed with no instruction on how to load the data. I removed the button and changed the constructor MainPage.xaml.cs to the following.
public MainPage()
{
InitializeComponent();
Service1Client sc = new Service1Client();
sc.GetAllStudentsCompleted += new EventHandler(sc_GetAllStudentsCompleted);
sc.GetAllStudentsAsync();
}
6. A label and a text (block or box) were added to the bottom of the page with no explanation; I would have settled for an ambiguous reference to a third tutorial.
7. Less serious, but still a possible point of confusion for a beginner, is the inconsistency in naming the Service1Client (‘sc’ versus ‘c’).
If I was a beginner and had attempted this tutorial, I would have given up in frustration and never visited your web site again.
One correction with number 4.
ReplyDelete4. I had to change
'c.GetListByNameCompleted +=new EventHandler(c_GetListByNameCompleted);'
in MainPage.xaml.cs (autoCompleteBox1_KeyUp method) to
'c.GetListByNameCompleted += new EventHandler(c_GetListByNameCompleted);'
before the project would compile.
One more time with number 4. The comment poster is filtering out the less-than and greater-than symbols to prevent unwanted markup.
ReplyDeletec.GetListByNameCompleted += new EventHandler[LESS_THAN_CHARACTER]GetListByNameCompletedEventArgs[GREATER_THAN_CHARACTER](c_GetListByNameCompleted);
May 28, 2010 9:16 AM