c# - Catel framework - Lazy property -
i'm trying create lazy property catel framework. there way it?
when i'm creating property in viewmodel this:
#region photos property /// <summary> /// gets or sets photos value. /// </summary> public fastobservablecollection<photo> photos { { var temp = getvalue<fastobservablecollection<photo>>(photosproperty); if (temp == null) photos = selectedpatient.getphotos(); return getvalue<fastobservablecollection<photo>>(photosproperty); } set { setvalue(photosproperty, value); } } /// <summary> /// photos property data. /// </summary> public static readonly propertydata photosproperty = registerproperty("photos", typeof (fastobservablecollection<photo>)); #endregion
the get
function called without binding, lazy property initializes while viewmodel initializing.
is there way it?
there 1 way implement "lazy properties", , using lazy<> class. reason mappings (such view model model, etc), catel uses setvalue directly instead of property wrapper (compare catel properties dependency properties).
Comments
Post a Comment