vb.net - WPF Binding Checkbox Content and IsChecked to Different Lists -


i have issue binding multiple properties single control. have 2 lists called userlist , grouplist. i'm trying display listview of checkboxes of groups in system. userlist object contains list of integers based on id of groups member of. i'd have checkboxes checked if userlist object contains id of group in grouplist.

for example, grouplist might contain ids 1,2,3,4. while userlist has list of ids of 1 , 3. i'd therefore checkboxes 1 , 3 checked, 2 , 4 unchecked.

to this, need bind 2 different properties @ same time , possible have kind of converter. i'm pretty new stuff, i'm kind of stuck try next. here's i've got -

<listview name="listbox1" grid.row="1" margin="30,4,30,22" fontfamily="segoe ui" fontsize="14" itemssource="{binding grouplist, updatesourcetrigger=propertychanged}"> <listview.itemtemplate>     <datatemplate>         <checkbox margin="2"                   content="{binding name}"                   ischecked="{binding source={staticresource usergroupdataprovider}}" />     </datatemplate> </listview.itemtemplate> 

obviously i'm missing kind of static resource, i'm not sure that.

any advice appreciated.

well, after bunch of research, ended using value converter. made oneway converts, doesn't convert - here's code used

    <checkbox.ischecked>         <multibinding converter="{staticresource collectiontoboolconverter}" mode="oneway">             <binding path="id" />             <binding elementname="me" path="user.grouplist" />         </multibinding>     </checkbox.ischecked> 

where elementname=me specified top form i'm using.

hopefully helps else out.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -