Wednesday, March 26, 2008

Silverlight Spy - Debug any silverlight application

http://www.silverlightspy.com/silverlightspy/

Check it out.Its an great tool to know what is inside Silverlight applications like
Snoop for WPF.

Saturday, March 15, 2008

What is the purpose of .xap file in Silverlight 2.0?

Normally when you start with Silverlight 2.0, you may notice the .xap file which is present in the ClientBin folder.(Eg if you create a project called TextSL,it will create a .xap file named testSL.xap).Since this is new to us ,we will wonder ,what that file contains..

Also this prevent us from getting the reflected code.(Currently the reflector accepts only dlls & exes I think).

Actually what is .xap files?or what is the format of .xap files?
Answer is simple
.xap files are zip files.ie just a zipped and renamed as .xap .Served as application/octet-stream or application/x-silverlight.

Why they (MSFT) introduced this new format..Here are my assumptions.

  1. Now the silverlight application starts only after downloading all the assets(Images videos etc in the project) and dlls.So downloading would be faster ,if these required files are in a zip file since zip employe a good compression.
  2. Just to get rid of reflection.(May this come from my reflecting mind.MSFT may have some other thoughts.They might not think of this reflection:-) )
  3. .......(MSFT can only fill,if there are any other reasons)

How to reflect

  1. Just rename .xap file as .zip file
  2. Decompress the .zip file
  3. Now you got the dlls and images.Enjoy reflecting.

Thursday, March 13, 2008

Silverlight 2.0 Class / Control hierarchy

This diagram helps very much to design our classes.ie from which class we have inherit
Find it here http://advertboy.wordpress.com/2008/03/13/silverlight-control-hierarchy/

Tuesday, March 11, 2008

Switch Silverlight 2.0 applications into FullScreenMode

Its too lengthy than the old procedure which we were doing in Silverlight 1.0 and Silverlight 1.1

Application.Current.Host.Content.IsFullScreen = true;

MessageBox in Silverlight 2.0

One more interesting features in Silverlight 2.0 due to browser interaction support ,is the "ability to use alert method of javascript"

Syntax
System.Windows.Browser.HtmlPage.Window.Alert(xaml);

I found it very useful to deal with exceptions..

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.