Home > DeveloperSection > Forums > WPF Binding Checkbox Content and IsChecked to Different Lists
Mark Devid
Mark Devid

Total Post:101

Posted on    September-24-2013 8:31 AM


 1 Reply(s)
 3222  View(s)
Rate this:

I have an issue with binding multiple properties to a single control. I have two lists called UserList and GroupList. I'm trying to display a ListView of checkboxes of all the groups in the system. The UserList object contains a list of integers based on the ID of the groups it is a member of. I'd like to have the checkboxes be checked if the UserList object contains an ID of a group in the groupList.

For example, the GroupList might contain IDs 1,2,3,4. While the UserList has a list of IDs of 1 and 3. I'd therefore like checkboxes 1 and 3 checked, but 2 and 4 unchecked.

To do this, I need to bind to two different properties at the same time and possible have some kind of converter. I'm pretty new to this stuff, so I'm kind of stuck as to what to try next. Here's what I've currently got -

<ListView Name="ListBox1"



FontFamily="Segoe UI"


ItemsSource="{Binding GroupList,




        <CheckBox Margin="2"

                  Content="{Binding Name}"

                  IsChecked="{Binding Source={StaticResource UserGroupDataProvider}}" />



Obviously I'm missing some kind of static resource, but I'm not sure what to do with that.

Any advice would be appreciated.

Pravesh Singh

Total Post:411

Posted on    September-24-2013 8:49 AM

Hi Mark,

here's the code I used


        <MultiBinding Converter="{StaticResource CollectionToBoolConverter}" Mode="OneWay">

            <Binding Path="ID" />

            <Binding ElementName="Me" Path="User.GroupList" />



Where ElementName=Me is specified up top as the form I'm using.

Hopefully this will solve your problem.

Don't want to miss updates? Please click the below button!

Follow MindStick