সোমবার, ২৪ জানুয়ারী, ২০১১

WCF RIA Serivces

I shall try to explain WCF RIA Services part by part in my blog post. In this post I defined the basic of WCF RIA Services.

WCF RIA Services simplifies the development of n-tier solutions for Rich Internet Applications (RIA), such as Silverlight applications.

A common problem when developing an n-tier RIA solution is coordinating application logic between the middle tier and the presentation tier.

To create the best user experience, you want your RIA client to be aware of the application logic that resides on the server, but you do not want to develop and maintain the application logic on both the presentation tier and the middle tier.

RIA Services solves this problem by providing framework components, tools, and services that make the application logic on the server available to the RIA client without requiring you to manually duplicate that programming logic.

You can create a RIA client that is aware of business rules and know that the client is automatically updated with latest middle tier logic every time that the solution is re-compiled.

The following illustration shows a simplified version of an n-tier application.

IA Services focuses on the box between the presentation tier and the data access layer (DAL) to facilitate n-tier development with a RIA Services client.

RIA Services adds tools to Visual Studio that enable linking client and server projects in a single solution and generating code for the client project from the middle-tier code.

The framework components support prescriptive patterns for writing application logic so that it can be reused on the presentation tier.

Services for common scenarios, such as authentication and user settings management, are provided to reduce development time.

রবিবার, ২ জানুয়ারী, ২০১১

Create a User Control using SL4 and Expression Blend 4.0

In this blog I shall discuss about Controls of Silverlight.

What is Control?

  1. Element of Software
  2. Encapsulate some User Interface related functionality
  3. There are two types of control:
    1. User Control
    2. Custom Control

a. User Control:

i. User Control is logical group of other controls.

ii. Typically used to separate a user interface in smaller parts that are easier to code and design.

iii. Following Example defines how to create a user control using Silverligt 4

I. Open VS-2010

II. Create a Silverlight Project Named it MyUserControlProject

III. Right Click on Silverlight Project from Solution Explorer

IV. Add->New Item->Silverlight User Control-> Named it MyUserControl.xaml->Add

V. From toolbox drag some controls i.e- Text Block, Combo Box, List Box etc and drop them on MyUserControl

VI. From Menu Select Build->Build Solution

VII. After Build the MyUserControl named User Control Icon should be available in Tool Box.

VIII. This Control should be use any page of this project by drag and drop the icon from toolbox.

iv. Following Example shows how to create a User Control from Expression Blend:

I. Open Expression Blend 4.

II. File-> New Project-> Silverlight Application

III. In Main.xaml drag some controls from Toolbox.

If all controls are not available then Go to Asset Tab->Controls-> Here All controls should be available.

IV. Drag Necessary Controls from Toolbox and Asset->Controls

V. Select Controls

VI. Click Right Mouse

VII. Make into User Control named MyNewUserControl

VIII. After Naming Click Ok. As a result all user control should be group and a New User Control should be create which name is MyNewUserControl.

IX. Now you will be able to change the place of group.

X. From Menu Select Build-> Build Project

XI. After build the project a icon of User Control Named MyNewUserControl should be create in Project of Asset Tab.

XII. This user control should be use any page of this project by drag the icon and drop it inside the page.

শনিবার, ১ জানুয়ারী, ২০১১

Extending Xaml and mapping prefix

Extensibility:

The abbreviation of XAML is eXtended Application Markup Language.

One of the important features of XAML is extensibility.

By extensibility feature external elements can be import inside a document without changing any feature.

How to Mapping a Prefix to CLR Namespace:

XAML has a special syntax for define namespace:

xmlns:Prefix=”clr-namespace:Namespace;assembly=AssemblyName”

Here-

· Prefix is the XML prefix you want to use to indicate that namespace in your XAML markup. For example, the XAML language uses the x: prefix.

· Namespace is the fully qualified .NET namespace name.

· AssemblyName is the assembly where the type is declared, without the .dll extension. This assembly must be referenced in your project. If you want to use your project assembly, leave this out.

For example, here’s how you would gain access to the basic types in the System namespace and map them to the prefix sys:

xmlns:sys="clr-namespace:System;assembly=mscorlib"

Example:

Think we need to place a Double value in the documents resources.

So we need to import Double value type document by creating a new xmlns statement because XAML is by default configured for user interface elements and the default namespaces do not map to Double type.

If we see following steps it might be much clearer for us:

  1. Create a new SL4 project named DoubleResoursces
  2. Open Main.XAML
  3. Under User Control / root tag we will type xamlns
  4. Define the prefix
  5. Press =
  6. Select System(mscorlib)
  7. Under UserControl.Resources add a double value resources.

200

100

  1. Finally add a Button within main grid by using the Double value from the resources.