Archive

Posts Tagged ‘silverlight3’

Silverlight 3 Navigation

May 28th, 2009 Laurens 't Hardt No comments

This post is about the session called What’s new in Silverlight 3 given by Mike Taulty.

A major disadvantage of RIA, Rich Internet Application, is that the state is of an application can not be recovered after the browser has been closed.

In Silverlight 3 there’s a solution for this problem. In SL3 you are now able to create a SL page. This in combination with the Frame and navigation Source make it possible to navigate through the same application based on the url.

The first part of the url is the path to the page on which the Silverlight page is located, for example http://localhost/SLapp.html.

After this the part of the url for the navigation within the application can be placed. This part must be preceded by a ‘#’, for example http://localhost/SLapp.html#SearchPage.xaml.

From webapplications we also now the querystring in the url for passing parameters to a site, this is also implemented in silverlight in the same way. The previously used url can then be formatted as followed http://localhost/SLapp.html#SearchPage.xaml?title=silverlight

More information about page navigation can be found at Mike Taulty’s blog.

Categories: DevDays09 Tags: , ,

Silverlight 3 Validation and Dataform control

May 28th, 2009 Jeffrey Tummers No comments

This post is about the session calledWhat’s new in Silverlight 3 given by Mike Taulty.

Silverlight 3 has a new way for validating data. The validation rules can be set in a number of different ways:

  • Throwing an exception
  • Adding specific attributes to the classes properties

I specifically like the way the business rules can be applied to an object. Some samples of specifying the validation are shown below.

class Person
{
[Required(ErrorMessage = “The name of the person is required”)]
public string Name { get; set; }

[Range(18, 65, ErrorMessage = ”The person must be between 18 and 65 years old”)]
[DefaultValue(20)]
public int Age { get; set; }
}

More validation attributes are available at MSDN

The nice thing about the new version of Silverlight 3 is that the default input controls can handle these validation errors and show them to the user, this is very similar to the way we know validation controls in ASP.NET. The way in which these messages are shown is fully customizable through themes.

sl3_dataform

The screenshot above shows an example of the new Dataform which is also available in Silverlight 3. It also gives you an example of the standard way a user is informed about errors.

With the new Dataform control it is possible to automatically render the CRUD GUI for an object or list of objects.

By implementing the IEditableObject interface for an object, the following events can be handled within the class: BeginEdit, CancelEdit and EndEdit

For more information about the Dataform control see the following blog post of Mike Taulty, another post by Mike Taulty is about data validation

Categories: DevDays09 Tags: , ,

Silverlight 3 Out of browser

May 28th, 2009 Laurens 't Hardt No comments

This post is about the session called What’s new in Silverlight 3 given by Mike Taulty

In Silverlight 3 it is now possible to run the application as a standalone desktop application. To enable this functionality this must be enabled in the AppManifest.xml file of the application.

<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
EntryPointAssembly="TaskList"
EntryPointType="TaskList.App">
<Deployment.Parts>
</Deployment.Parts>
<Deployment.ApplicationIdentity>
<ApplicationIdentity
ShortName="Task List"
Title="Offline Task List">
<ApplicationIdentity.Blurb>
Allows saving your tasks offline
</ApplicationIdentity.Blurb>
</ApplicationIdentity>
</Deployment.ApplicationIdentity>
</Deployment>

The user can now choose to install the application to the computer, on right mouse click the menu below is shown.

sp3_install_menu

Next the user can choose where the shortcuts to the application will be placed.

sl3_install_app

The application can now be run from out of the browser but still in the same secure sandbox. The application is automatically updated whenever a new version of the application is available from the website.

After the application is installed it’s very easy for the user to remove the application from the computer. When running the application under the right mouse menu the option to install the application is now replaced by the option to remove the application.

sp3_remove_menu

Because it’s now possible to run Silverlight applications from the desktop it’s now also become possible to run a Silverlight application without having a internet connection.

A nifty feature is now introduced to Silverlight 3 to adapt to this situation. It’s is now possible to detect whether an internet connection is available or not.

Through the method NetworkInterface.GetIsNetworkAvailable() it’s possible to see if an internet connection is available. Through the NetworkChange.NetworkAddressChanged event network changes can be detected when a user connect or disconnect from the internet.

Categories: DevDays09 Tags: , ,