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 9197451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:04:34+00:00 2026-06-17T22:04:34+00:00

I have such VM and Model code, thats represent Product class with implementation of

  • 0

I have such “VM” and “Model” code, thats represent Product class with implementation of INotifyPropertyChanged:

Model:

public class Product : INotifyPropertyChanged
{
    public Product(string name, bool isEnable)
    {
        Name = name;
        IsEnable = isEnable;
    }
    public string Name { get; set; }
    private bool _isEnable;
    public bool IsEnable
    {
        get { return _isEnable; }
        set
        {
            if (value != _isEnable)
            {
                _isEnable = value;
                OnPropertyChanged("IsEnable");
            }
        }
    }
    public event PropertyChangedEventHandler PropertyChanged;

    protected void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
            handler(this, new PropertyChangedEventArgs(propertyName));
    }
}

ViewModel:

    public ObservableCollection<Product> Products
    {
        get { return _products; }
        set { _products = value;}
    }
    private ObservableCollection<Product> _products = new ObservableCollection<Product>()
        {
            new Product("a", false),
            new Product("b", false),
            new Product("c", false),
        };

And View with ListBox where each Item is RadioButton:

<Window.Resources>
     <Style x:Key="RadioButtonListStyle" TargetType="{x:Type ListBox}">
        <Setter Property="SelectionMode" Value="Single"></Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ListBoxItem}" >
                    <Setter Property="Margin" Value="2" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <RadioButton GroupName="Gr1" 
                                      IsChecked="{Binding Path=IsEnable,RelativeSource={RelativeSource TemplatedParent},
                                      UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
                                 <ContentPresenter></ContentPresenter>
                               </RadioButton>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>
</Window.Resources>
<Grid Margin="5">
    <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition Height="Auto"></RowDefinition>
    </Grid.RowDefinitions>
    <ListBox x:Name="UserList" Style="{StaticResource RadioButtonListStyle}" ItemsSource="{Binding Products}">
    </ListBox>
</Grid>

But nothing happened every time when I click to the radiobutton. I could not reach to a breakpoint in the setter method on debug mode.

  • 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-06-17T22:04:35+00:00Added an answer on June 17, 2026 at 10:04 pm

    You should be referring your IsEnable Binding directly to the bound object (Product), rather than to the Templated Parent;

    <RadioButton GroupName="Gr1" IsChecked="{Binding Path=IsEnable}, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a such model named Foo: class Foo(models.Model): name = models.CharField() entry =
Suppose I have a simple model, such as Record: @Model public class Record {
I have two models such that class Employer(models.Model): code = models.CharField(null=False,blank=False,default=) class JobTitle(models.Model): employer
I have django models such as this class District(models.Model): name = models.CharField(max_length=30,unique=True) number =
I have a function in my Comic Model as such: <?php class Comic extends
I have a domain data model which returns a class such as the following:
Assuming that I have such model COLORS= ( ('R', 'Red'), ('B', 'Yellow'), ('G', 'White'),
I have a model of events that has various information such as date, location,
i have such code (copy paste from wiki). Its multiplication of those big numbers
I have such code, for making chain selects in my form View for index

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.