c# - Caliburn.Micro: Combobox is not populated -
i have wpf application caliburn.micro. trying populate new combobox added, stays empty, though other comboboxes on same view populated. debuged, know georgaphynames source collection in viewmodel populated correctly. please help?
here code:
model:
public class geographyname : propertychangedbase { private string _name; public string name { { return _name; } set { if (_name == value) return; _name = value; notifyofpropertychange(() => name); } } ... } view:
<combobox grid.row="6" grid.column="1" name="geographynames" displaymemberpath="name" selectedvaluepath="name" selecteditem="selectedgeographyname" style="{staticresource detailcombo}" /> viewmodel:
private bindablecollection<geographyname> _geographynames; public bindablecollection<geographyname> georgaphynames { { return _geographynames; } private set { if (_geographynames == value) return; _geographynames = value; notifyofpropertychange(() => georgaphynames); } } private geographyname _selectedgeographyname; public geographyname selectedgeographyname { { return _selectedgeographyname; } set { if (_selectedgeographyname == value) return; _selectedgeographyname = value; notifyofpropertychange(() => selectedgeographyname); ismodified = true; } } the combobox populated on changing selection in combobox:
private ldc _selectedldc; public ldc selectedldc { { return _selectedldc; } set { if (_selectedldc == value) return; _selectedldc = value; notifyofpropertychange(() => selectedldc); if (selectedldc != null) { georgaphynames = geographyname.getdata(selectedldc.ldcid); } ismodified = true; } }
your view model property called georgaphynames typo.
also, it's best use x:name in view, not name.
Comments
Post a Comment