.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

Group Radio Button In Silverlight Application

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

Group Radio Button In Silverlight Application. In this article we will see how we can achieve multi grouping in Silverlight.
 

Introduction

In this article we will see how we can achieve multi grouping in Silverlight.

Ordinarily, radio buttons are grouped by their container. That means if you place three RadioButton controls in a single StackPanel, they form a group from which you can select just one of the three.

Creating Silverlight Project

Fire up Blend 3 and create a Silverlight Application. Name it as RadioButtonGroupingInSL3.

radio1.gif

Add a Stack Panel into the Grid.

radio2.gif

radio3.gif

Now add three Radio Buttons into Stack Panel Name them as Group 1.

radio4.gif

Now at this point of time if you run your application you will find by default they are grouped, so that only one Radio Button can be selected.

if you place a combination of radio buttons in two separate StackPanel controls, you have two independent groups on your hands.

To achieve multi groping we will add another four Radio Buttons.

This time name them as Gropu 2 and Gropu 3.

radio5.gif

The GroupName property allows you to override this behavior. You can use it to create more than one group in the same container or to create a single group that spans multiple containers. Either way, the trick is simple-just give all the radio buttons that belong together the same group name.

  
    
    
      
      
    
    
    
    
    
    
    
    
    
    
    
  


Here, there are two containers holding radio buttons, but three groups. The final radio button at the bottom of each group box is part of a third group. In this example, it makes for a confusing design, but there may be some scenarios where you want to separate a specific radio button from the pack in a subtle way without causing it to lose its groupmembership.

Now if you run your application you will find the third Radio Button of the first Stack Panel can be selected too.

radio6.gif

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