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

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

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

Setting Complex Properties in WPF

In the last tutorial, we learnt how to create a simple WPF application using visual studio, how to add controls to the XAML and how to set properties to them (remember height and width of button?). The properties we set in the tutorial were, however, of simple value type. Not all properties are of simple value types. Some properties are made up of multiple objects, which might themselves have multiple properties, which might again have objects…you get the idea! These are complex type properties and setting them is slightly more complex too.

Let us consider the case of “Background” property on the Button control.

Continue reading

Getting Started with XAML

You should now have a basic understanding of what WPF is and when and why you should use it. Now come the components of WPF. The first thing you should understand, when developing WPF applications is XAML. XAML is the core of WPF applications (also of silverlight, but more of that later).

XAML stands for Extensible Application Markup Language. You pronounce it as “zamel”. It is an XML based language used for creating user interfaces in WPF + for serializing .NET object instances into a human readable format. It is also used by the workflow foundation for defining workflows but that is beyond the scope of this tutorial. The main advantage that XAML provides is declarative UI. You can create UI elements in the xaml, and then separate the visual aspect from logic by putting the logic in code-behind files (xaml.cs), joined to xaml through partial class definitions.

Continue reading

Introduction to WPF

This post is first among a series of tutorial posts that will teach WPF to beginners. The entire series will be divided into around 20-25 posts and each one should take you around 1/2 to 1 hour maximum to read and understand. If you follow them in the order that they have been written (from bottom to top), the series will not take more than a few days to complete. However, it is expected that you will have some basic background of .Net development and understanding of .Net framework before you begin these. If not, look forward to our next tutorial series on .Net development. All the code in these tutorials are written using Visual Studio 2012, and for database, we are going to use MS SQL 2008 R2. The code will work even on older versions of Visual Studio (those that support WPF) but you may have to change some things manually, and since it is not possible to list all the changes, we recommend using 2012 for a seamless learning experience. The express edition is free for trial.

Continue reading