How to convert a desktop application to the web
This is the second part of a series showing how to convert a desktop application written in Visual Basic to a Silverlight application. Putting Silverlight to work showed how to set up a Visual Studio solution, including both a Silverlight application and a web application.
The web application provides a web service with methods that get, save and delete items in a database. The database is an image catalogue, and the web service sends and receives custom objects of the type ‘photoitem’, but the same ideas work for any database.
The next step is to code the user interface and client-side logic in Silverlight. There are two parts to this. The user interface itself is most easily designed in XAML, an XML language, while for the code you can use Visual Basic or other .Net languages. You write the code in separate files using what Microsoft calls a code-behind model, similar to that in ASP.Net.
More about XAML
XAML stands for Extensible Application Markup Language, and was created by Microsoft as a declarative language for .Net, usually expressed as XML. XAML is best known as the layout language for Windows Presentation Foundation (WPF) and Silverlight, but it has other applications. The core of XAML is small, while WPF is a large add-on vocabulary.
A different vocabulary is used for the Workflow Foundation, another Microsoft technology. Conventionally, the x namespace in an XAML document refers to core XAML, which is why an object’s attribute is ‘x:name’ and not just ‘name’.
Although XAML documents are XML, it has some unusual features. You can set
properties either as attributes, or as ‘property elements’, child elements which
use dot syntax to show that they belong to their parent:
Another notable feature is called attached properties. An example is that child objects in a grid layout have attributes called Grid.Row and Grid.Column, which specify their location in the grid.
XAML also supports mark-up extensions, which are expressions within braces that are evaluated at runtime. One common use is for data-binding, as seen in the example below.
Updating your subscription status