Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6023945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:04:55+00:00 2026-05-23T04:04:55+00:00

I have radio button and I want to define binding between the radio button

  • 0

I have radio button and I want to define binding between the radio button IsChecked state and the visibility some stackpanel so I wrote this convert method:

 public class RadioBtnState2Visible : IValueConverter
{
    // RadioBtn start => Visible / Hide
    public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
    {
        if( value == null )
            return Visibility.Collapsed;

        bool visibility = false;
        bool.TryParse( value.ToString(), out visibility );

        return visibility ? Visibility.Visible : Visibility.Collapsed;

    }

    public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
    {
        throw new NotImplementedException();
        //return ( ( Visibility )value ) == Visibility.Visible ? true : false;
    }
}

The xaml is

<local:PageEx.Resources>   
     <local:RadioBtnState2Visible x:Key="Convert" /> 
</local:PageEx.Resources> 

<RadioButton x:Name="MyRadioBtn1" GroupName="group1" /> 
<RadioButton x:Name="MyRadioBtn2" GroupName="group1" />  

<StackPanel Visibility="{Binding ElementName=MyRadioBtn1, Path=IsChecked, Converter={StaticResource Convert}}" /> 

Now, I dont see any convert fire – i dont see that the application stops on the breakpoint that i set on the first line of the convert method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:04:56+00:00Added an answer on May 23, 2026 at 4:04 am

    This is a duplicate of your previous question, already answered. Here is the answer again:

    I got your code working in a test project with one minor change. I made the converter a page resource with the following syntax:

    <UserControl.Resources>
        <local:RadioBtnState2Visible x:Key="Convert" />
    </UserControl.Resources>
    

    I should also mention that I had to actually put something in the stackpanel as well to see the change as by default it collapses to nothing 🙂 I assume you actually have content in your real stackpanel.


    Just to explain what is happening here. By adding “local:” to the resource declaration you are actually enclosing an instance of a Resource, and not changing the current resource. Referencing it by “Convert” does not work because it cannot find the resource where it expects to find it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a radio button list and I want to perform some action when
I have a RadioButtnList. I want change body background color based on radio button
I have a set of radio buttons. In some cases I want the user
I have a radio button list and some of the labels are quite long
i have 2 void functions(trying to implement radio button), i want them to send
I have created radio button like this: @foreach (LoanQuestionIncludesStatement statement in item.Statements) { _question
here's what i want to achieve: Have a grouped radio button with different values
this may be a weird question but I have several radio button groups with
I have radio button list which has id as the value, I want to
I have a radio button list that has buttons like this: http://imageshack.us/f/545/capture1jtr.png/ However, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.