.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Silverlight >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Use DomainUpDown Control in Silverlight Application

Posted By:Diptimaya Patra       Posted Date: April 11, 2010    Points: 25    Category: Silverlight    URL: http://www.dotnetspark.com  

DomainUpDown Control in Silverlight Application. In this article we will see how can we use DomainUpDown Control available in Silverlight 3 Toolkit.
 

Introduction

In this article we will see how can we use DomainUpDown Control available in Silverlight 3 Toolkit.

Creating Silverlight Project

Fire up Visual Studio 2008 and create a Silverlight Application. Name it as DomainUpDownInSL3.

1.gif

Go ahead and add a DomainUpDown control and name it as MyDomainUpDown.

I have designed the page as follows:

2.gif

Now what we need is a collection of sample data.

Create a class and name it as States.cs

Add the following properties:

public class States
{
        public string State { get; set; }
        public string Capital { get; set; }
        public string Short { get; set; }
        public string Language { get; set; }
}

Now we need to make a data template of the DomainUpDown control and bind properties to it.


            
                
                    
                        
                            
                        
                        
                        
                            
                            
                            
                        
                    
                
            



Now we will create a sample list of data and assign the ItemSource of the DomainUpDown control to it:


public MainPage()
{
            InitializeComponent();
            List myList = new List 
            { 
                new States{ State="Andhra Pradesh", Capital="Hyderabad", Short="AP", Language="Telugu and Urdu"},
                new States{State="Arunachal Pradesh" , Capital="Itanager", Short="ARP", Language="Miji, Apotanji, Merdukpen, Tagin,Adi"},
                new States{State="Assam" , Capital="Dispur", Short="AS", Language="Assamese"},
                new States{State="Bihar" , Capital="Patna", Short="BH", Language="Hindi"},
                new States{State="Chhattisgarh" , Capital="Raipur", Short="CH", Language="Hindi"},
                new States{State="Goa" , Capital="Panaji", Short="GO", Language="Marathi and Konkani"},
                new States{State="Gujarat" , Capital="Gandhinagar", Short="GUJ", Language="Gujarati"},
                new States{State="Haryana" , Capital="Chandigarh", Short="HAR", Language="Hindi"},
                new States{State="Himachal Pradesh" , Capital="Shimla", Short="HP", Language="Hindi and Pahari"},
                new States{State="Jammu & Kashmir" , Capital="Srinagar, Jammu", Short="JK", Language="Kashmiri,Dogri, Urdu, Ladakhi"},
                new States{State="Jharkhand" , Capital="Ranchi", Short="JH", Language="Hindi"},
                new States{State="Karnataka" , Capital="Bangalore", Short="KR", Language="Kannda"},
                new States{State="Kerala" , Capital="Trivandrum", Short="KL", Language="Malayalam"},
                new States{State="Madhya Pradesh" , Capital="Bhopal", Short="MP", Language="Hindi"},
                new States{State="Maharashtra" , Capital="Bombay", Short="MH", Language="Marathi"},
                new States{State="Manipur" , Capital="Imphal", Short="MN", Language="Manipuri"},
                new States{State="Meghalaya" , Capital="Shillong", Short="MG", Language="Khasi, Jaintia and Garo"},
                new States{State="Mizoram" , Capital="Aizawl", Short="MZ", Language="Mizo and English"},
                new States{State="Nagaland" , Capital="Kohima", Short="NG", Language="Ao, Konyak, Angami, Sema and Lotha"},
                new States{State="Orissa" , Capital="Bhubaneswar", Short="ORI", Language="Oriya"},
                new States{State="Punjab" , Capital="Chandigarh", Short="PN", Language="Punjabi"},
                new States{State="Rajasthan" , Capital="Jaipur", Short="RJ", Language="Rajasthani and Hindi"},
                new States{State="Sikkim" , Capital="Gangtok", Short="SK", Language="Bhutia, Hindi, Nepali, Lepcha, Limbu"},
                new States{State="Tamil Nadu" , Capital="Chennai", Short="TN", Language="Tamil"},
                new States{State="Tripura" , Capital="Agartala", Short="TR", Language="Bengali, Tripuri, Manipuri, Kakborak"},
                new States{State="Uttar Pradesh" , Capital="Lucknow", Short="UP", Language="Hindi"},
                new States{State="Uttaranchal" , Capital="Dehra Dun", Short="UC", Language="Hindi"},
                new States{State="West Bengal" , Capital="Kolkata", Short="WB", Language="Bengali"}
            };
            MyDomainUpDown.ItemsSource = myList;
}  


That's it. Now run your application and you will find the following screen:

3.gif 

The good thing about this control is that when it reaches at the beginning or at the end the button gets disabled.

You can also download the sample code use in above example.

Enjoy Coding.



 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend