Simple web Browser with Animation using WPF

Dear Friends,
How are you ?
Today we will create a simplest web browser in WPF with some basic animation handling.
To do this task we have a simple control which is webBrowser control.
We need to just drag & drop webBrowser control and design the screen as you need just check out below fig.

once you done with the design.
Then to open a web page in browser control you need navigate method provided by webbrowser control.
The navigate method has string, uri parameter so you can utilize that according to your need.
Just check out below code.

The browser control also maintain forward , back history which we can utilize according to our need. Please see below code for that.

We can very much customize the web browser like block particular URL , bookmark etc.
Now you are just wondering that what is animation here ? so I would like to say that WPF give us tremendous opportunity for eye catching look and animation.
It give approx. 32 different animation object which is helpful in different scenario. All are available with name space “System.Windows.Media.Animation
”. Here I am with One of the simplest object which is double Animation.
The double animation is just basic animation control which can be utilize for animation you can do it with either XAML or code.
Here I am giving example of code.
So check out below code.
Dim da As New DoubleAnimation()
da.From = 30
da.To = 300
da.Duration = New Duration(TimeSpan.FromSeconds(1))
Me.wbctrl.BeginAnimation(WebBrowser.HeightProperty, da)
da.AutoReverse = True
da.RepeatBehavior = RepeatBehavior.Forever

Here wbctrl is webBrowser control . The double animation has duration property for how much time it will take. It has auto reverse property to
In the above code we using height property animation . just see below line

In similar manner you can go for width , position , opacity etc.
For more detail information please download attached code at

Enjoy coding.
Rajat jaiswal

Simple Game With WPF

Hello Friends,
As we know WPF is mainly related with designing stuff. So I just tried to utilize basic designing stuff and try to make a simple game which is Tic-Tac-To.
Right now the game use simple but attractive graphics (as you know I am not a good designer).
Later on we will make it more attractive using images.
You can download source code from Download Link

Till than b bye.
Enjoy Tic-Tac-To game. 🙂

Play Music with WPF

Hello friends,
Today I am coming with another passion after computer. “Music” is part of my life if it’s not in my life than I don’t know what happened to me. So I am dedicating this small creation to my musical friends who helps, enjoy music. Here I am with solution how to play synthesizer by WPF application.
I choose WPF here just because it’s very much attractive and I seem its give emphatic vision to my program, so friends its very simple and attractive task. We have to go in 3 simple steps.
Step1:- Design a WPF page with buttons as shown below fig.

Step2:- Download notes wav file (Sa,Re,Ga,Ma, Pa’s wav file) and include in your project.
Step3:- Now play music on key press and button click event as shown below
Dim btn As Button = CType(sender, Button)
Dim player As New SoundPlayer

Dim strPath As String = Configuration.ConfigurationManager.AppSettings(“path”).ToString()
Select Case btn.Name
Case “btnA”
player.SoundLocation = strPath & “\a.wav”
Case “btnB”
player.SoundLocation = strPath & “\b.wav”
Case “btnC”
player.SoundLocation = strPath & “\c.wav”
Case “btnD”
player.SoundLocation = strPath & “\d.wav”
Case “btnE”
player.SoundLocation = strPath & “\e.wav”
Case “btnF”
player.SoundLocation = strPath & “\f.wav”
Case “btnG”
player.SoundLocation = strPath & “\g.wav”
Case “btnH”
player.SoundLocation = strPath & “\gg.wav”
End Select
You can download the source code from Download link

I hope you all are musical lover and use it enhance it and more over send me updated version 
Enjoy music with dot net.
Rajat Jaiswal

Some useful Terminology (acronyms)

Hello friends,
Here I am with some useful terminology and these acronyms are generally used now days in broad way take a look.
1) ESB : Enterprise Service Bus
2) POX : Plain OLD XML
3) REST: Representational State Transfer
4) SOAP: Simple Object Access Protocol
5) RIA : Rich Internet Application
6) XML : Extensible Markup Language
7) JASON: Java Script Object Notation
8) DOM : Document Object Modeling
9) XAML : Extensible Application Markup Language
10) LINQ : Language Integrated Query
11) RSS: Really Simple Syndication
12) WCF: Windows Communication Foundation
13) WF: Windows Foundation
14) WPF: Windows Presentation Foundation
15) AJAX: Asynchronous Java script and XML
16) XLST: Extensible Style Sheet Language Transformation
17) INDIGO: Code name of Microsoft windows Communication foundation Technology
18) OSLO: Code name of Microsoft Modeling Technology
19) SOA: Service Oriented Architecture
20) ORCAS: dot net 3.5 Version called ORCAS
21) AVALON: code name of Microsoft Windows Presentation foundation Technology
22) Azure: Microsoft new Operation system Related to Cloud computing
23) Astoria : Code name of Data services

I hope you people like it.
Enjoy life with dot net.

Your host
Rajat Jaiswal

WPF Windows Persentaion Foundation with me PART- II

Hello friends,
In this session we are going to take a look how do we connect a silver light application with database.
So here I would like to say that there are basically 4 options by which you can handle database in silver light application.
1) WCF for Silver light
2) Data Services
3) Web services
4) RIA Services (need to explore more)

Here I will explain how to connect your WPF Silver light application with database using well know Web service.
It’s easy and I think we all already work on some part of Web services.

So let’s start with it.
We have added a silver light navigation project. In navigation silver light project part we have added 2 new pages employee, register page.
Employee page is for show employee list,And register page is for register employee.

Just see project structure as below.


And In web part we have added a new web service with name my services.
Whose functionality to save, updates, Delete, and read all employee record.
As shown in below fig.


Now our next step is how to integrate this web service with silver light.
For this we add a services reference in our navigation project with the help of Add services reference menu as shown below.


Now you can rename name space according to your choice.

If you do not get any error in referencing then till now you are ok with your work.
Now our next step is calling web method in our pages.
Here I am taking first page which is employee list
We are calling web method which returns all employee lists so here we go.

Private Sub EmployeePage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
Dim myBinding As New ServiceModel.BasicHttpBinding()
Dim myEndPoint As New ServiceModel.EndpointAddress(New Uri(“http://localhost/MyTest/MyWebService.asmx”, UriKind.Absolute))
Dim proxy As New MyWebServiceSoapClient(myBinding, myEndPoint)
AddHandler proxy.pub_ReadAllDataCompleted, AddressOf proxy_ReadAllEmployeeCompleted

Catch ex As Exception

End Try
End Sub

Private Sub proxy_ReadAllEmployeeCompleted(ByVal sender As Object, ByVal e As myService.pub_ReadAllDataCompletedEventArgs)
Me.myGrid.ItemsSource = e.Result
Catch ex As Exception
Me.HeaderText.Text = ex.InnerException.Message.ToString
End Try
End Sub

Now things to remember here
1) Dim myBinding As New ServiceModel.BasicHttpBinding()
Its shows the binding is http binding
2) Dim myEndPoint As New ServiceModel.EndpointAddress(New Uri(“http://localhost/MyTest/MyWebService.asmx”, UriKind.Absolute))
Here the path can be absolute or relative.

3) Next you have to call web method like we have call here proxy.pub_ReadAllDataAsync()
4) once we have call the method asyncronously then we have to make a event handler like we have create here

AddHandler proxy.pub_ReadAllDataCompleted, AddressOf proxy_ReadAllEmployeeCompleted

5) when the asyncronous method is complete we have to take result complete argument and covert according to our requirement.
I have just bind the result to datagrid and get below screen.
Just see below.


So friends in this way we can call web service in a Silverlight application.

Still we can use DataServices, RIA services, and WCF services for data manipulation application.

Hope in next few chapter we will take this example and work on it.

That’s all friends, thanks for reading the article.

Happy programming!


WPF Windows Persentaion Foundation with me PART- I

Hello friends,

Today we will discuss one of the most popular technologies which are silver light.
Before going forward you have some query in your mind. As I have so we will first solve that. See following questions.
1. What is Silver light?
Answer: – Silver Light is programmable web browser plug in, that enable feature such like vector graphics, animation and audio, video play back. It provide cross browser compatibility.
Its main aim to provide RIA (Rich Internet Application).Its Consistency with WPF (Windows Presentation Foundation). XAML (extensible Application Markup Language) is base of Silver light.
Its main use to provide end user a rich web application experience
Silver light basically used for RIA (Rich Internet Application) and with help of it we can make user friendly and all browser supported web sites.

2. What is XAML?
Answer: – XAML is core of Windows Presentation foundation. Its full form is Extensible Application Markup Language it’s just like a xml language with certain fixed tags. Like canvas, rectangle, grid etc…

3) From where I can download toolkit?
Answer: – We can download silver light 3.0 toolkits from site which is official site.

Here I will explain basic example of silver light. We are going to make a simple add 2 integer programs. I know you all aware of this but I started this for step by step progress in silver light.
For this you have to first install 3.0.
Once you have installed silver light 3.0 you will get following projects in new project window. Just select silver light application in this.


Once you have selected this then next screen comes up for the web site or web application selection. As shown below. I have selected web application.


After selecting web application project you will get 2 projects in your solution explorer one is for silver light in which there will be .XAML file. And another one is web application which is used to call XAML file in the compile format which is called XAP.

Now we start our actual work of making 2 digit sums in silver light application
For this we have to select mainPage.xaml.
In this XAML page we have to put all the control which is requiring like textbox, label or Text Block and button.
Suppose we have to add a TextBlock in page then see below lines

 Here x:Name is like id in our ASPX page it should be unique. Grid.Row = 0 and grid.column =0 shows position in grid.

Now similarly if you want to add a label and Textbox and button then
You have to follow below code.
<dataInput:Label x:Name=”lblResult” Grid.Row=”3″ Grid.ColumnSpan=”2″ HorizontalAlignment=”Center”></dataInput:Label>

<TextBox x:Name=”txtSecond” Width=”100″ HorizontalAlignment=”Left” Grid.Row=”1″ Grid.Column=”1″></TextBox >

< Button Name=”btnAdd” Content=”Add” Click=”btnAdd_Click” Width=”100″Grid.Row=”2″ Grid.ColumnSpan=”2″ HorizontalAlignment = “Center” >
</Button >
So the main this which you have to concentrate for alignment, colors.
In Next post we will come up with some solid project base & tool kit understanding.

till than  happy programming.