Friday, September 26, 2008

Silverlight 2 RC0 Released

Finally, the first public release candidate version has been released. InshaAllah, I will have more posts on this after Ramadhan.

A few links:
Official site: http://silverlight.net/GetStarted/sl2rc0.aspx
ScottGu's blog: http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx

Labels: , ,

Tuesday, August 12, 2008

Silverlight article posted at CodeProject

At last, I was able to complete and post my article: "My First Data Application in Silverlight" at CodeProject here: http://www.codeproject.com/KB/silverlight/MySilverlightDataApp.aspx
This one is a detailed article intended for beginners starting Silverlight. It discusses how data from a database can be retrieved and displayed in a silverlight application. It discusses how LINQ objects are returned using a WCF service and consumed in a silverlight application. On the layout side, it looks at the ListBox and DataGrid and provides an introduction to the data templates too. I think that most of the silverlight programmers have past experience of ASP.NET so I also discussed the similarities between ASP.NET and Silverlight. I hope people will find this article beneficial.

Labels: , , , , , , , , , ,

Thursday, August 07, 2008

Silverlight-enabled WCF Service template

Before Beta 2 of silverlight 2, we needed some tweaks with the standard WCF service template to use it in our silverlight application. But luckily, the new Silverlight-enabled WCF Service template does the job lot easier for us. Now we just need to define our methods(marked with OperationContract atribute) in the service.svc.cs file and we are ready to consume it. No need to change the binding configuration to basicHttpBinding, no need to add ASP.NET compatibility support in special cases, no need to define method signatures in a separate contract file. Just use the new template and use the service in your silverlight application without any worries.

Labels: , ,

Monday, August 04, 2008

I won a Silverlight competition

I am very glad to announce that yesterday, 4th of August, I stood first in a silverlight competition held at Sir Syed University of Engineering and Technology. In the 8 hour competition, the participants were asked to make a custom control "Drag and Drop Shopping Cart" in Silverlight 2 Beta 2. Here were the prizes I got:

  • MSDN Premium Subscription for 1 Year (Total Market Value: $10, 939)
  • 10,000 Rupees cash
It was a very wonderful experience. I will soon post my code here.

Labels: , , ,

Thursday, July 24, 2008

Assign percentage width to a column in silverlight grid

I was wondering how can I define the column widths for a silverlight/WPF grid with percentages like we use to define in html tables. This msdn document was quite helpful. Let me paste the important part here. The width attribute can take three type of values:

  • doubleValue: The column's width, expressed as a floating-point value for a pixel count. Typically this is given as an integer, although interpolation of floating-point values is supported by grid layout.
  • starSizing: A convention by which you can size rows or columns to take remaining available space in the Grid. A starSizing always includes the literal character *, and optionally precedes the * with an integer value that specifies what share of available space should be given as a weighted factor versus other possible star sizings (for example, 3*).
  • Auto: The column's width, described by the literal Auto.
So this is how we can define a grid with two equally divided rows and three columns divided in the ratio 1:2:3:

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=".5*"></RowDefinition>
<RowDefinition Height=".5*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>

The .5* in the row height can be changed to any value but both values must be same to make sure the rows are divided evenly.

Labels: , , , , , ,