Thursday, 15 August 2013

what is the type of TrackableCollectionOfMyObjectNamexSjLehPL coming from EF4(entity framework)- Mvvm-WPf

what is the type of TrackableCollectionOfMyObjectNamexSjLehPL coming from
EF4(entity framework)- Mvvm-WPf

I have 2 objects, lets say, Country and City- they have one to many relation,
country --> id, name
city--> id, countryid, city name
In view Model, i get the country list( everything is perfect), However,
the country.cities is in the type of TrackableCollectionOfCityxSjLehPL
although my service reference configuration, collection type is set to
system.collections.generic.list.
in my user interface, there is the grid view that shows list of countries
which is binded to to countrylist from view model, and another gridview
which is binded to selectedCountry.cities
it is working, however when i try to add a new city user clicks a button ,
its command in view model is like:
city newcity= new City();
SelectedCountry.Cities.Add(newcity),
NotifyProperyChanged(selectedCountry)
I expect it to be added in my grid view, right?? but no! its not being add
to city grid view, when i sort by clicking the column, it refreshes and i
see my newly added city!
I think I should implement CollectionChanged- because the changing part is
actually inside a list of my county, but since its
TrackableCollectionOfCityxSjLehPL , i can't do that, and there is no
information about this type, it sometimes comes sometimes not....
I don't want to seperate the objects like making another list for cities
and bind that in Wpf part, because eventually i save the whole country in
the end, or refresh the grid in the code behind.......
So if you saw this type of list and had a problem like this, I would be
really glad if somebody gives me some information

No comments:

Post a Comment