Tuesday, December 18, 2007

Data access in Silverlight by calling web service

Silverlight is a amazing technology which gives you stunning look for your web applications. But the released versions dont have support to access data directly.Also you cant do cross domain web requests from a silverlight domain.

So as a solution you have to go for some other techniques for data access as well as to get data from other web sites. Hers is a small technique which access web service. You can provide a data source from a out side service local web service.

Here is a solution which uses GETISD service from a webservice and exposes a local service

This technique employs a local web service to access data from out side .Silverlight application will be communicating to this local service only.

Download sample here

Tuesday, November 27, 2007

Limitations of Silverlight fullscreen mode

We could make any Silverlight application into full screen by setting the fullScreen property of Silverlight object.

//Silverlight 1.0
plugIn.content.fullScreen =true; //Where plugIn is the Silverlight control.

//Silverlight 1.1
BrowserHost.IsFullScreen = true;

//Silverlight 2
App.Current.Host.Content.IsFullScreen =true

But when we switch into full screen we will lost some functionalities .They are

  1. Not able to capture key strokes ie no keyboard support
  2. HTML overlay elements will be hidden : This is because we are just making th Silverlight control full screen.Not the entire HTML page.

Wednesday, November 14, 2007

Some wpf and silverlight books here


Foundations of WPF: An Introduction to Windows Presentation Foundation By Laurence Moroney
Essential Windows Presentation Foundation By Chris Anderson

Tuesday, November 6, 2007

Zooming in Silverlight

There is no direct support to zoom a control like in WPF.But we could work around using RenderTransform.

  1. Add a ScaleTransform in the RenderTransform section
  2. Manipulate the X & Y values of ScaleTransform through code behind.ie in a Click event

Detailed steps

  1. Create a new SilverlightJavascript application ( Silverlight 1.0)
  2. Then you can see a Canvas which looks like a Button.Add 2 more canvases for ZoomIn and ZoomOut
    <Canvas Name="ZoomIn" Width="100" Height="50" Canvas.Top="370" >
    <TextBlock Text="Click me to ZoomIn"/>
    <Canvas Name="ZoomOut" Width="100" Height="50" Canvas.Top="370" Canvas.Left="150" >
    <TextBlock Text="Click me to ZoomOut"/>

  3. Add event handlers on LeftMouseDown in Scene.XAML.js file
    this.ZoomIn = rootElement.children.getItem(1);
    this.ZoomIn.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.mouseDownZoomIn));

    this.ZoomOut = rootElement.children.getItem(2);
    this.ZoomOut.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.mouseDownZoomOut));

  4. Write Handlers
    var transform=this.button.RenderTransform;
    var transform=this.button.RenderTransform;
    if(transform.ScaleX >1){

A sample is located here

Welcome to Silverlight -The new web experience

Welcome all to the new web platform Silverlight which delivers colorful,stunning & dynamic web content over alomst all the platforms.

First of all thanks to MSFT for making it compatible with MAC & Linux...

This uses the WPF technology which have XAML,Transforms etc to make the life easier...

The sad thing is that we need to have some knowledge in Javascript to write interactive code.Anyway a C# version named Silverlight Alpha 1.1 is coming...

But this have some limitations.No Controls,No Styling etc...Hope MSFT will make Silverlight stable soon... which enables developers to choose this for Production