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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:46:47+00:00 2026-06-10T00:46:47+00:00

I am creating WPF elements dynamically in code behind, and for each of the

  • 0

I am creating WPF elements dynamically in code behind, and for each of the rows in the Grid I’m building it consists of a CheckBox and a Dynamic number of TextBoxes. The interaction that is needed is the following:

  • If all TextBoxes in a row have a value of 0, set the CheckBox
    IsChecked property to true and Disable it.
  • If one of the TextBoxes is then changed from 0, enable the
    CheckBox and set IsChecked to false.
  • If the user clicks on the CheckBox, set all associated TextBoxes
    to 0 and Disable the CheckBox

I was able to accomplish the first part of the last one using this code:

Binding setScoreToZeroIfIsNormalChecked = new Binding("IsChecked");
setScoreToZeroIfIsNormalChecked.Source = this.NormalCheckBoxControl;
setScoreToZeroIfIsNormalChecked.Converter = m_NormalCheckBoxJointScoresConverter;
tempJointScoreControl.JointScoreContainer.SetBinding(ContainerBase.SingleAnswerProperty, setScoreToZeroIfIsNormalChecked);

and the converter:

public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
    if (value is bool && targetType == typeof(Answer))
    {
        if ((bool)value)
        {
            Answer answer = new Answer();
            answer.Value = "0";
            answer.DisplayValue = "0";
            return answer;
        }
        else
            return null;
    }
    else
    {
        return null;
    }
}

However, in attempting to create another converter to accomplish other functionality, I was running into issues of converters stepping on one another since all functionality is based around the CheckBox.IsChecked property.

Is there anyway to accomplish all of the above using one or two multibinding converters? I’d really like to avoid having to create a whole bunch of events and maintaining them in order to do this.

  • 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-10T00:46:49+00:00Added an answer on June 10, 2026 at 12:46 am

    It’s relatively easy. Everything should resolve around CheckBox IsChecked property.
    For a simple reason, it’s a two-way property. So either you can modify it, or CheckBox can modify it.

    So what you do, you use MultiBinding, as such:

        MultiBinding multiBinding = new MultiBinding();
        multiBinding.Converter = multiBindingConverter;
    
        multiBinding.Bindings.Add(new Binding("Text") { Source = txtbox1});
        multiBinding.Bindings.Add(new Binding("Text") { Source = txtbox2});
    
        multiBinding.NotifyOnSourceUpdated = true;//this is important. 
        checkBox.SetBinding(CheckBox.IsCheckedProperty, multiBinding);
    

    And in your multiBindingConverter, you will have object[] value as first parameter, which you need to convert into IList and iterate over it && do your calculations, if you should either return true/false.(IsChecked=true or false)

    Now bind CheckBox IsEnabled to CheckBox IsChecked property, and use BooleanInverterConverter. (If CheckBox is checked, it should be disabled, and vice versa)

    The last step is to make TextBoxes listen to actual IsChecked property of CheckBox.
    If it is TRUE, they all should show value of 0, otherwise they can show what they want.

    So, make a new MultiBinding.

        MultiBinding multiBinding = new MultiBinding();
        multiBinding.Converter = textboxMultiBindingConverter;
    
        multiBinding.Bindings.Add(new Binding("IsChecked") { Source = checkbox1});
        multiBinding.Bindings.Add(new Binding("Text") { Source = textbox1});
    
        multiBinding.NotifyOnSourceUpdated = true;//this is important. 
        textbox1.SetBinding(TextBox.Text, multiBinding);
    

    the idea in textboxMultiBindingConverter is to either return Text(value[1]) if value[0]==FALSE or “0” if value[0]==TRUE.

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

Sidebar

Related Questions

I am creating Grid elements dynamically onto a stack panel. When an object is
I am creating a WPF data grid, and I want to be able to
Context: I'm creating a Login interface using WPF 4 which consists of two Label
I am creating a custom WPF control that uses the following markup: <custom:FilterPanel Grid.Row=1
Using the MVVM pattern creating WPF applications you have the ViewModel providing data to
Is there any good tutorial for creating WPF controls entirely at runtime? Thanks
I have begun creating a wpf mvvm app. It seems a vital ingredient to
If you are creating a WPF window or a WPF page, you can bind
I am creating a WPF app using MVVM. The app manages tagged documents, called
I am creating a WPF app that needs to allow users to work in

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.