Passing Data from Child Window to Parent Window in Silverlight

Posted By:Diptimaya PatraPosted Date:March 13, 2010Points:25
Category: SilverlightURL:http://www.dotnetspark.comPassing Data from Child Window to Parent Window in Silverlight. In this article we will see a sample implementation of this requirement to pass the value or data from the ChildWindow to the Parent Window.

Introduction

There were many requirements where we need to pass the value from ChildWindow to our Parent Window in Silverlight. In this article we will see a sample implementation of this requirement to pass the value from the ChildWindow to the Parent Window.

This is the idea what we are going to do. We will select a date from the calendar from the ChildWindow and pass the selected value to the Parent Window and display it.

Creating Silverlight Project

Fire up Visual Studio 2008 and create a new Silverlight 3 Project. Name it as ChildToParent.

Now first things first add a ChildWindow to the Silverlight Project name the ChildWindow as DatePopUpWindow.

Now that we have added everything needed we will design our page in Blend as follows:

I have added one TextBlock to display the Selected Date and one Image; on it's click the ChildWindow will be fired up.

Now we will design our Childwindow as follows:

As you see from the above image; I have added a calendar to the ChildWindow.