Checking connectivity to your server using silverlight and javascript (synchronous)

In general, checking connectivity to your server using silverlight and javascript is not a very complex task. A normal service call or a web client can do this. However, there may be situations when these are not sufficient. For instance, there may be a situation when you need to connect to the server synchronously. Since service calls and web clients only allow you to connect asynchronously, you will need to do something extra to accomplish what you want. The trick here is to let javascript check for connectivity and the reply back to silverlight as shown:

Continue reading

Embedding files into Open XML documents using C#

Ever since Microsoft released Version 2.0 of the Open XML SDK (Software Development Kit), there has been a lot of hype around it. It represents several exciting opportunities for developers, particularly with the features available in the second version. Anyone who has worked with XML will probably be familiar with Open XML too, but just to recap – Open XML is essentially an open ECMA 376 standard that defines a set of XML schemas for representing different type of word processing documents, spreadsheets, charts, ppts and so on. While the newer versions (2007 onwards) of Microsoft Office Word, Excel, PowerPoint etc have all been using Open XML as the default file format, lately more and more developers have started exploring the features, due to the ability provided by the SDK to manipulate Open XML documents using relatively familiar technologies like ZIP and XML.

Continue reading

Configuring Silverlight Applications

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usually needs to be configurable. Putting this information within the code makes it rather rigid as changing this at the time of implementation would mean recompiling your entire assembly. Due to this, most applications tend to use configuration settings for such dynamic parameters.
Continue reading

BAML vs XAML

XAML(eXtensible Application Markup Language) is an XML-based language, through which a developer can create rich UI easily and much more rapidly for WPF or Silverlight applications.
Anything that can be done in XAML can also be done in codebehind.
When we compile our WPF application in Visual studio, it compiles the XAML files into a compressed format called BAML (Binary Application Markup Language) and saves it to the assembly as resources with .BAML extension. On calling InitializeComponent() from WPF constructor, it will load the BAML file from assembly and create the object.

Continue reading

Using Hierarchical Data templates

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls for several of my UI requirements and find that they are quite easy to use once you get the hang of it. However, the controls can seem a little confusing and hard to use for a beginner, especially if you have a background only in winforms. It is much easier if you try to work with individual controls and understand their behavior in the beginning stages.
Continue reading