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

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.

শুক্রবার, ৩১ ডিসেম্বর, ২০১০

Silverlight 4.0: Create a Simple Silverlight 4.0 Application with E...

Silverlight 4.0: Create a Simple Silverlight 4.0 Application with E...: "In this blog post I am going to discuss about creating a simple silverlight application with expression blend 4.0. 1. Start Visual Studio 2010 2. ..."

Create a Simple Silverlight 4.0 Application with Expression Blend 4.0

In this blog post I shall discuss about creating a simple silverlight application with expression blend 4.0.
1. Start Visual Studio 2010
2. Select File-> New-> Project
3. In New Project dialog box Select Silverlight Application and create a new Silverlight Application named MyProject-> Click Ok button.
4. A new dialog box will appear. In this dialog box you have to choose where you want to host the silverlight application you may choose a new ASP.NET Website or a new ASP.NET MVC Application.
5. Don't Check Enable .NET RIA Services
6. Click OK.
7. In Main.xaml go to XAML code and write following code:








8. From Toolbox drag a Text Block and drop it inside Main.xaml
9. From Property Palette of Text Block Set Following properties
a. Horizontal Alignment : Center
b. Vertical Alignment: Center
c. Margin : 0
d. Height : Auto
e. Width: Auto
f. FontFamily: Verdana
g. Font Size : 72
h. FontWeight: Bold
i. Forground : White
j. Text: Hello Silverlight
k. Name: no name/null
10. Press F5 to run the program
11. Stop Debugging
12. Right Click on Main.xaml->Open in Expression Blend
13. In Expression Blend Select TextBlock from Objects and Timeline panel-> Copy it by clicking right mouse / Ctrl+C-> Past It by clicking Right Mouse/Ctrl+V
14.Click New Text Block (That you have been paste)-> Set the name as Shadow from properties
15.Select Shadow named Text block from Objects and Timeline panel
16.Assets->Effects->BlurEffect->drag BlurEffect-> drop it on Shadow Named Text Block-> As a result BlurEffects Should be set up in Objects and Timeline panel.
17. From Objects and Timeline Panel Select BlurEffects
17.From Properties set Radius=50
18.In the Objects and Timeline panel Click on +(plus) signed icon-> Create Storyboard Resource dialog named ShadowStoryboard->as a result Blend will turns in recording mode.
19. Set opacity property of Shadow named text block = 0%
20. Move the yellow vertical line to 500.
21. Select the Shadow TextBlock-> Click Record Keyframe button from the top of ShadowStoryboard.
22. Select ShadowStoryboard from top of the objects and timeline panel ->Check Auto Reverse-> Set RepeatBehaviour=3x
23. Select the Text Block (Null / no name)->from properties set cursor=Hand
24. Select Event Icon from Top right corner of Properties->Double Click on MouseLeftButtonDown-> Wright following code:-

private void textBlock_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var storyboard=this.Resources["ShadowStoryboard"] as Storyboard;
if(storyboard!=null)
{
storyboard.Begin();
}
}
25. Press F5 to run the project