Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All

I have 2 radio button rd1 and rd2 which were set style is button,
I want to when user click on rd2 -> set border for rd2 and clear border rd1
and when user click on rd1 -> set berdor for rd1 and clear border of rd2.


i am new WPF, so please help me

thanks in advence
Posted
Comments
Abhipal Singh 26-Jun-15 0:54am    
What do you exactly mean by border of radio button?
Can you please provide xaml of your radio button or WPF page? may be, it will help us understand the problem better?
Suvendu Shekhar Giri 26-Jun-15 2:40am    
Could not you do that using BorderBrush & BorderThickness properties?

1 solution

In case, if you want to show difference in look and feel between selected and unselected RadioButtons, you can use some themes.

As you are new to WPF, I suggest Infragistics Metro Light theme. And, you need to set your RadioButton style to ToggleButton like

XML
<radiobutton name="rd1" groupname="Test" removed="Option 1" style="{StaticResource {x:Type ToggleButton}}" />
<radiobutton name="rd2" groupname="Test" removed="Option 2" style="{StaticResource {x:Type ToggleButton}}" />


Applying theme:
In your Visual Studio, open Package Manager Console by going to View menu -> Other Windows -> Package Manager Console

Then, copy and paste following command in your Package Manager Console and press enter.
It will take little moment to install theme.

Install-Package Infragistics.Themes.MetroLight.Wpf


After that, Open your App.xaml presented in your project, and Paste following code

XML
<ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Themes/Metro/Metro.MSControls.Core.Implicit.xaml" />
                <ResourceDictionary Source="Themes/Metro/Metro.MSControls.Toolkit.Implicit.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>


in between

XML
<application.resources> <!-- paste here --> </application.resources>


Now compile and run your project, you will get clear differentiation in look and feel between selected and unselected options(radiobuttons) .

Please notify if my answer is satisfy your need.

Thank you.
 
Share this answer
 
v2

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