Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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
Updated 18-Feb-13 19:43pm
v2
Comments
Sergey Alexandrovich Kryukov 19-Feb-13 1:52am    
Why? Why?!
—SA

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
 
Share this answer
 
Comments
ANKIT_JHA 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 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
ANKIT_JHA 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 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
ANKIT_JHA 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.
Hi.if you working with WPF you can use ControlTemplate Like this:
XML
<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
 
Share this answer
 
Comments
ANKIT_JHA 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900