WPF ComboBox Binding Errors -
i've searched hours , not find existing solutions problem i'm having. here please if can. when bind combobox
selectedvaluepath
seeing bindingexpression path errors
in output window:
system.windows.data information: 41 : bindingexpression path error: 'geounitid' property not found 'object' because data item null. happen because data provider has not produced data yet. bindingexpression:path=geounitid; dataitem=null; target element 'combobox' (name=''); target property 'notarget' (type 'object')
system.windows.data information: 20 : bindingexpression cannot retrieve value due missing information. bindingexpression:path=geounitid; dataitem=null; target element 'combobox' (name=''); target property 'notarget' (type 'object')
system.windows.data information: 21 : bindingexpression cannot retrieve value null data item. happen when binding detached or when binding nullable type has no value. bindingexpression:path=geounitid; dataitem=null; target element 'combobox' (name=''); target property 'notarget' (type 'object')
system.windows.data information: 10 : cannot retrieve value using binding , no valid fallback value exists; using default instead. bindingexpression:path=geounitid; dataitem=null; target element 'combobox' (name=''); target property 'notarget' (type 'object')
the binding work correctly, , correct values displayed, suspect these errors reason poor performance seeing (scrolling/loading timing). here's relevant xaml:
<listview x:name="lvitems" grid.row="1" grid.column="0" itemssource="{binding elementname=mywindow, path=items, mode=twoway}" gisc:listviewsort.issortable="true"> <listview.view> <gridview> <gridview.columns> <!-- selecteditembinding: source:int32, dest:dest:int16 --> <gridviewcolumn> <gridviewcolumnheader tag="countryofissue" content="countryofissue" /> <gridviewcolumn.celltemplate> <datatemplate> <grid> <combobox itemssource="{binding elementname=mywindow, path=countries}" selectedvaluepath="geounitid" selectedvalue="{binding path=countryofissueid, mode=twoway}" displaymemberpath="shortname" style="{staticresource grideditstyle}" /> </grid> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> </gridview.columns> </gridview> </listview.view> </listview>
i've verified itemssource
collection not have null items. i've tried entirely different structure (wpf datagrid
instead of listview
/gridview
structure shown above similar results). scrolling performance terrible small number of rows (~400). searched ways improve scrolling performance, solutions did little help. there tons of these binding errors suspect root cause.
edit (added relevant types)
//listview collection (dependency property defined in usercontrol):
public static readonly dependencyproperty itemsproperty = dependencyproperty.register( "items", typeof(corpactionautopostconfigs), typeof(corpactionautopostconfigcontrol2) ); public corpactionautopostconfigs items { { return (corpactionautopostconfigs)getvalue(itemsproperty); } set { setvalue(itemsproperty, value); } }
//the type (observable collection) listview bound to
public class corpactionautopostconfigs : observablecollection<cadb.corpactionautopostconfig>, icloneable { //code omitted }
//the collection item type (defined in assembly don't have source code). wrote relevant public property below.
cadb.corpactionautopostconfig { public int countryofissueid {set; get;} }
//combobox items collection (dependency property defined in usercontrol)
public static readonly dependencyproperty countriesproperty = dependencyproperty.register( "countries", typeof(countries), typeof(corpactionautopostconfigcontrol2) ); public countries countries { { return (countries)getvalue(countriesproperty); } set { setvalue(countriesproperty, value); } }
//the type (observable collection) combobox bound to
public class countries : observablecollection<rds.country> { //code omitted }
//the collection item type (defined in assembly don't have source code). wrote relevant public properties below.
rds.country { public int geounitid {get;} public string shortname {get;} }
Comments
Post a Comment