wpf - ViewModel support in Portable Class Library -
i trying out pcl in vs 2010 project in support wpf (4 , higher) , silverlight (4 , higher). ms documentation excerpt below confusing me.
it seems saying reference system.windows in pcl project, don't see how that.
what must have icommand , inotifypropertychanged in pcl project?
supporting view model pattern when target silverlight , windows phone 7, can implement view model pattern in solution. classes implement pattern located in system.windows.dll assembly silverlight. system.windows.dll assembly not supported when create portable class library project targets .net framework 4 or xbox 360.
the classes in assembly include following:
system.collections.objectmodel.observablecollection
system.collections.objectmodel.readonlyobservablecollection
system.collections.specialized.inotifycollectionchanged
system.collections.specialized.notifycollectionchangedaction
system.collections.specialized.notifycollectionchangedeventargs
system.collections.specialized.notifycollectionchangedeventhandler
system.windows.input.icommand
the .net framework 4 contains these classes, implemented in assemblies other system.windows.dll. use these classes portable class library project, must reference system.windows.dll , not assemblies listed in .net framework 4 documentation
edit
inotifypropertychanged not available; code below not compile
public abstract class viewmodelbase : inotifypropertychanged { public virtual event propertychangedeventhandler propertychanged; ... }
yes, msdn confusing on point (is there error ?)
basically, have nothing !
whe create pcl project, select appropriate frameworks.
pcl automatically manage references you.
public abstract class viewmodelbase : inotifypropertychanged { public event propertychangedeventhandler propertychanged; protected virtual void onpropertychanged(string propname) { if (propertychanged != null) { propertychanged(this, new propertychangedeventargs(propname)); } } }
let's try !
Comments
Post a Comment