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

Aspx versus Razor

If you have been using the later versions of Visual Studio (2010 and above), you might have seen a new template for Asp.Net websites called “Razor”. Razor is a view engine that allows you to add server code into web pages.

So, what is the big deal, you may ask. Didn’t asp.net allow it too? Yes, it did. The difference, however, is that it is much simpler, compact and cleaner to add server code using razor as compared to traditional aspx. If you are a beginner in Asp.net with good html skills, then you will be able to learn and build web applications very easily in Razor compared to other view engines.

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

Android Application Development Platform: An Overview

Mobile applications, in general, are software applications that run on mobile devices and platforms and perform predefined functions, often with the help of simple user interfaces. Most mobile phones come with several built-in applications from the manufacturers. Some common examples of built-in mobile applications include messaging services, games, calendar, alarm clocks, calculators and organizers. According to the Mobile Marketing Association, mobile applications can be divided into the categories of communication, games, multimedia, productive tools, travel and utility features.

Continue reading

Some Advanced Controls in WPF

In the previous tutorials, we have learnt about basic controls, their positioning and their placement within panel controls. In this tutorial, we are going to tackle some slightly advanced controls and their usage. These controls, in conjunction with panels and other classes, aid in advanced and intelligent layout creation. Some commonly used slightly advanced controls include TabControl, GroupBox, Menu and Expander. We are going to study each of these in further detail now.

Continue reading

Commonly used Panels in WPF

In the previous tutorial, we learnt how to create a simple application using the DockPanel. In this tutorial, we will learn about application layouts and the support that WPF provides to arrange controls in a good layout using different types of panel controls. So far, we have learnt about creating basic WPF programs, adding controls and properties. We also already know about simple controls like buttons and textboxes. Remember, a control is something that derives from System.Windows.Controls.Control base class. Most elements that you come across in a WPF UI are controls. The base class in turn derives from System.Windows.FrameworkElement base class, which provides them with framework-level set of properties, events, and methods. The properties help in fine-tuning their positioning and appearance. For example, margin and horizontal/vertical alignment are some properties.

But haphazardly arranging the controls is not going to lead to a good application no matter how correctly or intelligently you add the controls or how much you attempt to control their positioning. Fortunately, as we learnt in tutorial 1, WPF has built-in intelligent layout capabilities to arrange the visual elements of an application. Before beginning to experiment further with the intelligent layout capabilities of WPF, it is important to understand about panel controls that play a large part in helping you arrange other controls efficiently. We will now learn about different panel controls and see the usage of some of the most commonly used panels.

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

FontViewer

In the previous tutorials, we learnt how to create a WPF application using visual studio templates, and we also learnt how to use some basic controls and set their properties. Now, let us make a cool FontViewer program as the next step. This program is taken from Sams Teach Yourself WPF in 24 Hours book – an excellent resource for beginners to WPF.

Continue reading