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

  • Home
  • SEARCH
  • 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 6371649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:06:23+00:00 2026-05-25T01:06:23+00:00

I am using this question/answer as source code for my current need. It works

  • 0

I am using this question/answer as source code for my current need.
It works fine but I can select my radiobutton only once. Here is my code :

<StackPanel Orientation="Vertical" Grid.Column="0"  >
    <sdk:Label Content="Materiale:" Margin="0,0,0,5" />
    <RadioButton GroupName="Materiale" Margin="0,0,0,2"  
                    Content="All" 
                    IsChecked="{Binding Path=Materiale, 
                                Mode=TwoWay,
                                Converter={StaticResource EnumToVisibilityConverter},
                                ConverterParameter=All}"
                    Command="{Binding CambioMaterialeCommand}" />
    <RadioButton GroupName="Materiale" Margin="0,0,0,2"  
                    Content="RotabiliSingoli" 
                    IsChecked="{Binding Path=Materiale,
                                Mode=TwoWay,
                                Converter={StaticResource EnumToVisibilityConverter},
                                ConverterParameter=RotabiliSingoli}"
                    Command="{Binding CambioMaterialeCommand}" />
    <RadioButton GroupName="Materiale" Margin="0,0,0,2"  
                    Content="Treni" 
                    IsChecked="{Binding Path=Materiale,
                                Mode=TwoWay,
                                Converter={StaticResource EnumToVisibilityConverter},
                                ConverterParameter=Treni}"
                    Command="{Binding CambioMaterialeCommand}" />
    <RadioButton GroupName="Materiale" Margin="0,0,0,2"  
                    Content="CarrozzeLocomotive" 
                    IsChecked="{Binding Path=Materiale, 
                                Mode=TwoWay, 
                                Converter={StaticResource EnumToVisibilityConverter}, 
                                ConverterParameter=CarrozzeLocomotive}"
                    Command="{Binding CambioMaterialeCommand}"/>
</StackPanel>

In the ViewModel, I have :

public void CambioMateriale()
        {
            switch (Materiale)
            {
                case E_Materiale.All:
                    IsVisibleLocomotivaCarozza = false;
                    IsVisibleTrenoPartenza = false;
                    break;
                case E_Materiale.RotabiliSingoli:
                    IsVisibleLocomotivaCarozza = false;
                    IsVisibleTrenoPartenza = false;
                    break;
                case E_Materiale.Treni:
                    IsVisibleLocomotivaCarozza = false;
                    IsVisibleTrenoPartenza = true;
                    break;
                case E_Materiale.CarrozzeLocomotive:
                    IsVisibleLocomotivaCarozza = true;
                    IsVisibleTrenoPartenza = false;
                    break;
            }

        }

When putting a breakpoint on the switch, I can see the Materiale value changing when going from one radiobutton to the other, but if I try to reselect one radiobutton I already selected, this value does not change and keep to the radiobutton value selected before.

Could someone explain me what is going on?

Thanks for your help,

[Edit]

here is my enum converter :

   public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        string parameterString = parameter as string;
        if (parameterString == null)
            return DependencyProperty.UnsetValue;

        if (Enum.IsDefined(value.GetType(), value) == false)
            return DependencyProperty.UnsetValue;

        object parameterValue = Enum.Parse(value.GetType(), parameterString, true);

        return parameterValue.Equals(value);
    }


    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return value.Equals(true) ? parameter : DependencyProperty.UnsetValue;
    }

[/EDIT]

  • 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-25T01:06:23+00:00Added an answer on May 25, 2026 at 1:06 am

    Here is the link to article that might help you to achive task easily or to resolve your issue:
    Binding RadioButtons to an Enum in Silverlight

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

Sidebar

Related Questions

I am using the code I posted as an answer to this question to
EDIT: This question is solved, but I can't accept my own answer just yet.
I feel stupid asking this question, but I can not find a clear answer
I can run this code in Android app (using PhoneGap adn jQuery Mobile) but
Im using the answer to this question to convert an array of XML to
Using this answer , I created a sample localized app. My question is, is
From this question , a neat answer about using COALESCE to simplify complex logic
An answer to this question has led me to look into using Event Tracing
I asked this question awhile ago, but didn't get a usuable answer. Basically, I
There are a few questions that approach an answer to this question, but none

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.