I wanna share…

When I was installed the Silverlight Template to VS IDE, everything is went fine. But the problem is happened when I run the Silverlight application.

I faced error like this Unable to start debugging. The Silverlight managed debugging package isn’t installed. So what’s the solution?

The Solution is

  1. You might already have lower version Silverlight chainer. So uninstall everything related to Silverlight from Control panel Add and Remove programs.
  2. Download and install the Silverlight Developer runtime (any version you want) EX: 3.0
  3. Download and install Silverlight 3.0 Tools
  4. Create and Run the application. The application will run successfully.

Nice PDF to know about SharePoint MySite

Go through this Download link: Click Here

.NET Framework 2.0, 3.0 and 3.5

.Net Framework is a common environment for building, deploying and running web services and applications like web applications, window applications, mobile applications etc.

You can see the .NET Framework 2.0 diagram below.

  1. Windows Forms
  2. Active server pages
  3. .Net Framework base classes
  4. Common Language Runtime

Now, I will tell you some important points regarding Framework.

Common Language Infrastructure (CLI):

Common Language Infrastructure allows software components to:

  1. Pass data between each other without regard to the Programming languages.
  2. Execute on Different Operating Systems and Different Hardware platforms without having to compile a High-Level source code.

An Implementation of Common Language Infrastructure is known as Common Language Runtime.

Common Language Runtime (CLR):

Common Language Runtime is a very important one in .Net Framework. It manages building, deploying and running .Net applications. It is known as Virtual Execution System (VES). The code which is run by Virtual Execution System is known as Managed Code.

Common Language Runtime responsibilities are:

  1. Garbage Collection: CLR manages memory leaks automatically.
  2. Code Access Security: Manages privileges like Read-only, write-only etc
  3. Code verification: Type safety

Common Type System (CTS):

Common Language Runtime facilitates the Common Type System (CTS). A Number of types are supported by CLR and described by CTS. Both Value types are supported:

  • Primitive data types (int etc)
  • Reference types. (Arrays, strings etc)

In order that two languages communicate in a smooth way. Ex: Vb.Net uses Integer and vc++ uses long data types. Communication between these two is complicated. So two languages use CTS to communicate with each other. CTS will change those data types into System.Int32 to communicate easily.

Common Language Specification (CLS):

Common Language Specification is a subset of Common Type System (CTS).

It facilitates all .Net languages into an umbrella; in other words, communication among .Net languages in a seamless manner.

Microsoft Intermediate Language (MSIL):

.Net Source code is compiled into Intermediate Language (IL), also called Common Intermediate Language (CIL). CLR runs the IL code into machine code. (Occurred at the time of application is installed).

.NET 2.0 to .NET 3.5

If we can observe .Net Framework from 2.0 version to 3.5 Version

These are the changes that happened:

  • WCF-Windows Communication Foundation
  • WPF-Windows Presentation Foundation
  •  WWF-Windows Workflow Foundation

Windows communication foundation:

WCF is a programming Platform and run time system for building, running and deploying the network distributed services. It is the latest Service oriented technology.

Interoperability is the fundamental characteristics of WCF. It has web service, .Net remoting, MSMQ and COM+. It combines all these things into a single umbrella.

Means it provides a common platform for all .Net communication.


Windows Presentation Foundation (WPF):

Windows Presentation Foundation is a Microsoft’s Next generation UI Framework to create applications like rich user experience. It is the part of .Net Framework 3.0 and higher.

You can see the below picture that shows the features of Windows Presentation Foundation (WPF).


We can use these tools to get rich applications called Microsoft Expression. It consists of the four products:

Expression Blend is built to create user interfaces in WPF and Silverlight. It builds the bridge between designer and developers. It can open VisualStudio solutions

Expression Design is a lightweight version of Adobe Illustrator to create and edit vector graphics.

Expression Media is built to encode, cut and enrich video files and optimize them for silverlight streaming

Expression Web is Microsoft’s next generation of HTML and Javascript editor. Its the replacement for Frontpage.

String and String Builder classes

DownLoad link: Click Here

Strings are plays a major role in our programming world. To deal with these Strings we are using String and StringBuilder classes.

String:

A string is a sequential collection of Unicode characters that is used to represent text. String is a class which belongs to the namespace System. String.

String Concatenation can be done using ‘+’ opearator or String.Concat method.

String.Concat method concatenates one or more instances of String.

Sample code:

string string1 = “Today is ” + DateTime.Now.ToString (“D”) + “.”;

Console.WriteLine (string1);

string string2 = “Hi ” + “This is Jitendra “;

string2 += “SampathiRao.”;

Console.WriteLine(string2);

StringBuilder:  StringBuilder is a class which belongs to the namespace System.Text. This class cannot be inherited.

In StringBuilder we are using Append () method.

Sample code:

StringBuilder number = new StringBuilder (10000);

for (int i = 0; i<1000; i++)

{

returnNumber.Append (i.ToString ());

}

 So where we can use these classes?

The answer is for simple String manipulations we can use String class. But the string manipulations are more it is better to use StringBuilder class.

Why the StringBuilder class is better for more string manipulations instead of String class?

The String object is immutable. Every time you use one of the methods in the System. String class, you create a new string object in memory, which requires a new allocation of space for that new object. In situations where you need to perform repeated modifications to a string, the overhead associated with creating a new String object can be costly. It’s nothing but performance of the application might be decreased. So we are using StringBuilder in such cases.

StringBuilder object is mutable. The System.Text.StringBuilder class can be used when you want to modify a string without creating a new object. For example, using the StringBuilder class can boost performance when concatenating many strings together in a loop.”

Differences between String and StringBuilder:

It belongs to String namespace It belongs to String. Text namespace
String object is immutable StringBuilder object is mutable
Assigning:

String s= ”something important”;

Assigning:

StringBuilder sbuild= new StringBuilder(“something important”);

We can use ‘+’ operator or Concat method to concatenate the strings. Here we are using Append method.
When string concatenation happens, additional memory will be allocated. Here additional memory will be allocated when the string buffer capacity exceeds only.

                               Ajax Accordion pane control in .Net

Download Link: Click here

The Accordion control represents a series of panes that can be viewed one at a time. So this is so useful

where the content publishing place is small.

These are the Key Properties:

HeaderCssClass:

Name of the CSS class to use for the headers. This can be either applied to the Accordion as a default for all AccordionPanes, or an individual AccordionPane.

HeaderSelectedCssClass:

Name of the CSS class to use for the selected header. This can be either applied to the Accordion as a default for all AccordionPanes, or an individual AccordionPane.

ContentCssClass:

Name of the CSS class to use for the content. This can be either applied to the Accordion as a default for all AccordionPanes, or an individual AccordionPane.

FadeTransitions:

True to use the fading transition effect, false for standard transitions.

TransitionDuration:

Number of milliseconds to animate the transitions

HeaderTemplate:

The Header template contains the markup that should be used for an pane’s header when data binding

ContentTemplate:

The Content template contains the markup that should be used for a pane’s content when data binding.

Here I’m explaining tell you about AccordionPane control.

  1. Drag and drop the ToolkitScriptManager and Accordion controls from Ajax Toolkit.
  2. Drag and drop the AccordianPane control between pane tags.
  3. Add these properties to Accordion control.

a. CssClass,

b. HeaderCssClass,

c. HeaderSelectedCssClass,

d. ContentCssClass

This is the Style sheet I used:

<style type=”text/css”>

.accordionpane {

width: 300px;

}

.accrdHeader {

border: 1px solid #2F4F4F;

color: white;

background-color: #006B54;

font-family: Arial, Sans-Serif;

font-size: 12px;

font-weight: bold;

padding: 5px;

margin-top: 5px;

cursor: pointer;

}

.accrdHeaderSelected {

border: 1px solid #CBEBFA;

color: white;

background-color: #9D6B84;

font-family: Arial, Sans-Serif;

font-size: 12px;

font-weight: bold;

padding: 5px;

margin-top: 5px;

cursor: pointer;

}

.accrdContent {

background-color: #F5DEB3;

border: 1px #CBEBFA;

border-top: none;

padding: 5px;

padding-top: 10px;

}

</style>

This is the Accordin pane stuff:

<asp:ToolkitScriptManager ID=”ToolkitScriptManager2″ runat=”server”>

</asp:ToolkitScriptManager>

<asp:Accordion ID=”Accordion2″  CssClass=”accordionpane” HeaderCssClass=”accrdHeader” HeaderSelectedCssClass=”accrdHeaderSelected” ContentCssClass=”accrdContent” runat=”server”>

<Panes>

<asp:AccordionPane ID=”AccordionPane3″ runat=”server”>

<Header>About Myself</Header>

<Content>

I am Jitendra.SampathiRao. I’m basically from Vishakapatnam. I completed my B.Tech(Computer Science) from JNT University.

I’m presently working in a vizag baseb software company from last two years.

</Content>

</asp:AccordionPane>

<asp:AccordionPane ID=”AccordionPane4″ runat=”server”>

<Header>Technical Skill set</Header>

<Content>

<b>My Technical Skill set is:</b><br />Asp.Net, <br />C#.Net, <br />VB.Net, <br />WCF, <br />WPF, <br />Silverlight,<br />Sql Server, <br />Mysql, <br /> AJAX, <br /> JQuery.

</Content>

</asp:AccordionPane>

<asp:AccordionPane ID=”AccordionPane5″ runat=”server”>

<Header>Hobbies</Header>

<Content>

Playing Cricket,<br />Watching movies, <br /> Net surfing.

</Content>

</asp:AccordionPane>

</Panes>

</asp:Accordion>

Note: Source Code is available at download links.

The final result should be like:

I hope you like this article.

Button Animation in WPF

DownLoad Link: Click Here

Here I am describing about how to apply the animation for button control.  I defined a button control like this:

<Button Margin=”99,88,99,99″ Name=”button1″

Style=”{DynamicResource TransformingButton}” Content=”Enter” Foreground=”SpringGreen” BorderBrush=”Violet” OpacityMask=”DarkRed” IsCancel=”True” SnapsToDevicePixels=”False” ToolTip=”Please Click….” FontFamily=”Verdana” FontSize=”14″>

</Button>

You can see the DynamicResource name in Style property.

DynamicResource: DynamicResources are resolved at runtime. Use DynamicResources when the value of the resource could change during the lifetime of the Application.

I defined a Style in App.xaml file means under the Application.Resources tags.

Application.Resources: Resources defined at the application level can be accessed by all other pages that are part of the application.

These are the elements which are I used in the application.

ControlTemplate: Controls in Windows Presentation Foundation (WPF) have a ControlTemplate that contains the visual tree of that control. You can change the structure and appearance of a control by modifying the ControlTemplate of that control. There is no way to replace only part of the visual tree of a control; to change the visual tree of a control you must set the Template property of the control to its new and complete ControlTemplate.

Specifies the visual structure and behavioral aspects of a control that can be shared across multiple instances of the control.

StoryBoard: A Storyboard is a type of container timeline that provides targeting information for the timelines it contains. A Storyboard can contain any type of Timeline, including other container timelines and animations.

ContentPresenter: The concept of ContentPresenter is quite simple – it is a placeholder for any XAML content and it can be used to insert content at runtime.

Key-Frame Animation: Like a From/To/By animation, a key-frame animation animates the value of a target property. It creates a transition among its target values over its Duration.

ColorAnimationUsingKeyFrames: Animates the value of a Color property along a set of KeyFrames over a specified Duration.

DoubleAnimationUsingKeyFrames: Animates the value of a Double property between two target values using linear interpolation over a specified Duration.

SplineColorKeyFrame: Spline key frames like SplineColorKeyFrame create a variable transition between values according to the values of the KeySpline property

Code under Application.Resources is:

<Style x:Key=”TransformingButton” TargetType=”{x:Type Button}”>

<Setter Property=”Template”>

<Setter.Value>

<ControlTemplate TargetType=”{x:Type Button}”>

<ControlTemplate.Resources>

<Storyboard x:Key=”StoryBoard1″>

<ColorAnimationUsingKeyFrames BeginTime=”00:00:00″ Storyboard.TargetName=”ellipse” Storyboard.TargetProperty=”(Shape.Fill).(SolidColorBrush.Color)”>

<SplineColorKeyFrame KeyTime=”00:00:00″ Value=”PaleVioletRed”>

</SplineColorKeyFrame>

<SplineColorKeyFrame KeyTime=”00:00:30″ Value=”Violet”>

</SplineColorKeyFrame>

</ColorAnimationUsingKeyFrames>

<DoubleAnimationUsingKeyFrames BeginTime=”00:00:00″ Storyboard.TargetName=”ellipse” Storyboard.TargetProperty=”(UIElement.Opacity)”>

<SplineDoubleKeyFrame KeyTime=”00:00:00″ Value=”0.9″></SplineDoubleKeyFrame>

<SplineDoubleKeyFrame KeyTime=”00:00:30″ Value=”0.5″></SplineDoubleKeyFrame>

</DoubleAnimationUsingKeyFrames>

<DoubleAnimationUsingKeyFrames BeginTime=”00:00:00″ Storyboard.TargetName=”ellipse” Storyboard.TargetProperty=”(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)”>

<SplineDoubleKeyFrame KeyTime=”00:00:00″ Value=”0″/>

<SplineDoubleKeyFrame KeyTime=”00:00:30″ Value=”360″/>

</DoubleAnimationUsingKeyFrames>

<DoubleAnimationUsingKeyFrames BeginTime=”00:00:00″ Storyboard.TargetName=”ellipse” Storyboard.TargetProperty=”(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)”>

<SplineDoubleKeyFrame KeyTime=”00:00:00″ Value=”0.953333333333333″/>

<SplineDoubleKeyFrame KeyTime=”00:00:30″ Value=”0.5″/>

</DoubleAnimationUsingKeyFrames>

<DoubleAnimationUsingKeyFrames BeginTime=”00:00:00″ Storyboard.TargetName=”ellipse” Storyboard.TargetProperty=”(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)”>

<SplineDoubleKeyFrame KeyTime=”00:00:00″ Value=”0.95″/>

<SplineDoubleKeyFrame KeyTime=”00:00:30″ Value=”0.5″/>

</DoubleAnimationUsingKeyFrames>

</Storyboard>

</ControlTemplate.Resources>

<Grid>

<Ellipse x: Name=”ellipse” Fill=”CornflowerBlue” Stroke=”Wheat” RenderTransformOrigin=”0.5,0.5″>

<Ellipse.RenderTransform>

<TransformGroup>

<ScaleTransform/>

<SkewTransform/>

<RotateTransform/>

<TranslateTransform/>

</TransformGroup>

</Ellipse.RenderTransform>

</Ellipse>

<ContentPresenter HorizontalAlignment=”{TemplateBinding HorizontalContentAlignment}” VerticalAlignment=”{TemplateBinding VerticalContentAlignment}” SnapsToDevicePixels=”{TemplateBinding SnapsToDevicePixels}” RecognizesAccessKey=”True”/>

</Grid>

<ControlTemplate.Triggers>

<EventTrigger RoutedEvent=”FrameworkElement.Loaded”></EventTrigger>

<Trigger Property=”IsFocused” Value=”True”/>

<Trigger Property=”IsDefaulted” Value=”True”/>

<Trigger Property=”IsMouseOver” Value=”True”>

<Trigger.EnterActions>

<BeginStoryboard Storyboard=”{StaticResource StoryBoard1}”></BeginStoryboard>

</Trigger.EnterActions>

</Trigger>

<Trigger Property=”IsPressed” Value=”True”/>

<Trigger Property=”IsEnabled” Value=”False”/>

</ControlTemplate.Triggers>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

Run the application and when the mouse over or click happens; the buttons rotates clockwise, gradually changes its color and size shrinks.

Before Focused or Mouse over or Click:

After Focused or Mouse over or Click:

DownLoad link: Click Here

Definition: Method signature in base class as well as in derived class should be same.

If you are not satisfied with the implementation of a method in the parent class, you can keep the same declaration (signature and return type), but provide a different implementation.

Important Points::

  1. By using virtual and override keywords we can accomplish Method overriding.
  2. The virtual modifier indicates to derived classes that they can override this method.
  3. The override modifier allows a method to override the virtual method of its base class at run-time.

To achieve Run-time polymorphism or Late Binding, we are using Method Overriding concept.

Here, I am writing a simple program.

using System;

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication3

{

class baseclass

{

public virtual int Add(int a, int b)

{

return a + b;

}

}

class subclass : baseclass

{

public override int Add(int x, int y)

{

int d = 20;

return base.Add(x,y)+d;

}

}

class subclass2 : baseclass

{

public int Add(int x, int y)

{

int d = 40;

return base.Add(x, y) + d;

}

}

class something

{

public static void Main(String[] args)
{

baseclass baseclsinst = new baseclass();

Console.WriteLine(“Base class Addition::::::::::::” + baseclsinst.Add(23, 23));

baseclass bscls = new subclass();

Console.WriteLine(“Derived class addition:::::::::” + bscls.Add(34, 54));

baseclass bscls2 = new subclass2();

Console.WriteLine(“Derived class addition:::::::::” + bscls2.Add(34, 54));

Console.ReadLine();

}

}

}