I had a bit a free time last week to play around with silverlight. A couple of observations based on my 2 hours of playtime are:
1. Silverlight/XAML in general feel alot like Adobe FLEX
2. coding for silverlight won't make sense until you understand it is a CLIENT side technology so you will need to work with data connectivity just like you would with Javascript (making a AJAX call) or FLEX/FLASH making a call to a webservice. So since silverlight runs on the client side it doesn't have access to a SQL datasource (for security reasons).....you'll need to reference a service (see notes and code below).
Getting Data into a grid. Below is a little snippet from the codebehind of a xaml page.
The process i went through was
1. created a WCF service library (don't forget about the clientaccesspolicy.xml..what a pain)
2. Referenced Library in Silverlight project
3. OnLoad call the webservice method that returns a collection (in my case) "GetIssuesAsync()"
4. Add a method that captures the webservice methods "Complete" event
public Page()
{
InitializeComponent();
Loaded += new RoutedEventHandler(Page_Loaded);
}
void Page_Loaded(object sender, RoutedEventArgs e)
{
ServiceReference1.Service1Client webservice = new Service1Client();
webservice.GetIssuesCompleted += new EventHandler<GetIssuesCompletedEventArgs>(webservice_GetIssuesCompleted);
webservice.GetIssuesAsync();
}
public void webservice_GetIssuesCompleted(object sender, GetIssuesCompletedEventArgs e)
{
dataGrid1.ItemsSource = e.Result;
}