checkbox - How to add values to resources from a list? (wpf) -
i have combobox filtering purposes , want "all" first value of it. , have added check boxes each items can select multiple items. when "all" checked want other items checked. , when unchecked other items should unchecked.
resource:
<x:array x:key="source" type="sys:string"> <sys:string>apple</sys:string> <sys:string>orange</sys:string> <sys:string>grapes</sys:string> </x:array>
combobox:
<combobox x:name="myfilter"> <combobox.itemssource> <compositecollection> <comboboxitem> <checkbox x:name="all" foreground="black">all</checkbox> </comboboxitem> <collectioncontainer collection="{staticresource source}"/> </compositecollection> </combobox.itemssource> <combobox.itemtemplate> <datatemplate> <checkbox name="chkfruits" content="{binding}" foreground="black" ischecked="{binding elementname=all, path=ischecked, mode=oneway}"></checkbox> </datatemplate> </combobox.itemtemplate> </combobox>
and want bind fruit list.
so questions are:
1) there way bind list collectioncontainer?
2) if can't bind property directly collectioncontainer other ways can this?
3) have tried add list values resource.
<x:array x:key="source" type="sys:string"></x:array>
assume fruit list
list<string> fruitlist = new list<string>() {"apple", "orange","grapes", "pineapple"};
i have tried didn't work.
resources.add("source", fruitlist);
is there way add list values source?
Comments
Post a Comment