c# - what is the type of TrackableCollectionOfMyObjectNamexSjLehPL coming from EF4(entity framework)- Mvvm-WPf -
i have 2 objects, lets say, country , city- have 1 many relation,
country --> id, name
city--> id, countryid, city name
in view model, country list( perfect), however, country.cities in type of trackablecollectionofcityxsjlehpl although service reference configuration, collection type set system.collections.generic.list.
in user interface, there grid view shows list of countries binded to countrylist view model, , gridview binded selectedcountry.cities
it working, when try add new city user clicks button , command in view model like:
city newcity= new city(); selectedcountry.cities.add(newcity), notifyproperychanged(selectedcountry)
i expect added in grid view, right?? no! not being add city grid view, when sort clicking column, refreshes , see newly added city!
i think should implement collectionchanged- because changing part inside list of county, since trackablecollectionofcityxsjlehpl , can't that, , there no information type, comes not....
i don't want seperate objects making list cities , bind in wpf part, because save whole country in end, or refresh grid in code behind.......
so if saw type of list , had problem this, glad if gives me information
1 - delete current service references.
2 - add reference model
assembly (project) viewmodels:
--mysolution |-- myproject.model | |-- (model classes) | |-- myproject.viewmodels | |--references | | |--myproject.model.dll <-- need | | | |--(viewmodel classes) | |----(etcetera)
this allows "reuse existing types" when creating service reference:
that prevent horrible trackablecollectionofcityxsjlehpl
ever showing up.
3 - re-add service references , make sure select option shown above.
4 - not want handle collectionchanged
in trackablecollection. keep viewmodel separate model, otherwise run huge maintainability / scalability issues.
Comments
Post a Comment