wpf binding to static resource -


so have aproblem binding in wpf. trying bind datagrid comboboxcolumn static resource no luck. know problem i'm not sure how fix it.

in xaml have this:

<local:myclasificators x:key="cllist"></local:myclasificators> 

and datagridcomboboxcolumn

<datatemplate>     <combobox itemssource="{staticresource cllist}" displaymemberpath="value"  ></combobox> </datatemplate> 

code source i'm binding:

public class myclasificators:list<keyvaluepair<object, object>> {     public void _myclasificators(datatable country)     {         foreach (datarow row in country.rows)         {             this.add(new keyvaluepair<object, object>(row.itemarray[0], row.itemarray[1]));         }     } 

and code passing datatable:

public void callmyclassificators(datatable country) {     myclasificators clasif = new myclasificators();     clasif._myclasificators(country); } 

i know have edit resource part, i'm not sure how should go it?

<local:myclasificators x:key="cllist"></local:myclasificators> 

translates like:

resources.add("cllist", new myclasificators()); 

that's it, there's no data in object.

you create resource cllist code, example in app.xaml.cs:

var countrytable = ... // or create table here var cllist = new myclasificators(); var cllist.callmyclassificators(countrytable); resources.add("cllist", cllist); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -