Tuesday, March 11, 2008

Passing values from website to Silverlight control

Here is one simple technique to pass values from website (aspx page where Silverlight control resides) to silverlight control.
This employes the InitParameters property of silverlight control to hold the values.

<asp:Silverlight ID="Xaml1" 

runat="server"

Source="~/ClientBin/MySilverlight.xap"

Version="1.1"

Width="1024px" Height="768px"

PluginBackColor="#0C0C0C"

InitParameters="Name=Joy"/>

In Silvelight application (App.xaml.cs)



private void OnStartup(object sender, StartupEventArgs e)

{

Page p = new Page();

p.UserName = e.InitParams["Name"];//Accessing initParams

this.RootVisual = p;


}

Thursday, March 6, 2008

Silverlight 2.0 release

It finally arrived .Now I am free to blog on it...
Download links are posted here.
http://blogs.msdn.com/tims/archive/2008/03/05/download-links-for-mix08-announcements.aspx
Some key features I noticed in Silverlight 2.0 are

  1. Databinding
  2. Templating support
  3. Styling
  4. New controls such as Calendar ,DataGrid.(even WPF dnt have native grid)
  5. 2 layout panels Grid & StackPanel
  6. ArrangeOverride and MeasureOverride on FrameworkElements :-)
  7. Linq
  8. Easy integration into ASP.NET using <asp:silverlight/> tag without script.Dont know how to integrate in php or jsp sites since there is no <asp:silverlight/> control.

And lot of new features which will be discussing in subsequent posts.

So welcome Silverlight 2.0 and hope MSFT will make it stable in order to use it in production environment.