Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows form Radbutton
Hi,
 
I want a set of radio buttons in a form so as to provide the liberty to select more than one radio button. I know we can achieve this using containers like GroupBox and Panel. But I have been asked to do this without using those containers. Its basically seem to provide the functionality of Check Box to Radio Buttons.
 
Thanks in Advance.
Ankit
Posted 18-Feb-13 20:41pm
Edited 18-Feb-13 20:43pm
v2
Comments
Sergey Alexandrovich Kryukov at 19-Feb-13 1:52am
   
Why? Why?!
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Never attempt to do it. First of all, it will enormously confuse the users.
 
(By the way, I just found that it's technically quite possible. Just a funny exercise in logical thinking. Anyone who knows how radio buttons work, not even on programming level, should be able to find out the trick. This is a hint. But please, do yourself a big favor, don't even thing about doing it for a real application.)

 
Good luck,
—SA
  Permalink  
Comments
ankitjha23 at 19-Feb-13 2:05am
   
Actually I am quite new to windows programming and C#. It would be very helpful if you could please elaborate your hint;-)
Sergey Alexandrovich Kryukov at 19-Feb-13 2:16am
   
Are you going to use Radio Buttons as Check Boxes? Don't do it.
The hint is only for a funny exercise, and it does not really require development experience. If I disclose it, what's the fun?
Please understand, no practical use of it, and we don't need abuse, do we? :-)
—SA
ankitjha23 at 19-Feb-13 2:51am
   
NO not at all. Just for fun my mentor asked to do. I'll get an answer and get back to forum.By the way Thanks for your immediate response.
Sergey Alexandrovich Kryukov at 19-Feb-13 11:40am
   
OK, but didn't you get the idea. Remember what happens if you, as a user, click on a radio button. A previously checked one is unchecked, and this is the problem, right? And what if you already have two different radio buttons checked? This is possible, right? You could see in in many applications. Why it was possible? It's easy...
—SA
ankitjha23 at 20-Feb-13 23:50pm
   
But I don't want tom make Checked=true. The privilege of checking is to be given to the user.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi.if you working with WPF you can use ControlTemplate Like this:
<RadioButton Content="MyRadioButton" Height="15">
            <RadioButton.Template>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <CheckBox Content="{TemplateBinding Content}"/>
                </ControlTemplate>
            </RadioButton.Template>
        </RadioButton>
i think it's not logical because each control has own domain usage.but choose yourself.
Good Luck
  Permalink  
Comments
ankitjha23 at 19-Feb-13 3:32am
   
I am working with windows form. But any ways, I appreciate your response.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 230
2 BillWoodruff 205
3 DamithSL 165
4 Sergey Alexandrovich Kryukov 155
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100