Here's an example from
this forum thread:
private bool _loadingScore = false;
private static PropertyInfo ScoreInfoProperty =
RegisterProperty(new PropertyInfo("ScoreInfo", "ScoreInfo"));
public Score ScoreInfo
{
get
{
if (!_loadingScore && (!FieldManager.FieldExists(ScoreInfoProperty) || ReadProperty(ScoreInfoProperty) == null))
{
#if SILVERLIGHT
_loadingScore = true;
Score.GetScore(
ReadProperty(ProfileIDProperty),
ReadProperty(PersonNameProperty),
ReadProperty(NicknameProperty),
ReadProperty(TeamIDProperty),
((TeamMemberInfoList)this.Parent).ParentTeam.Name,
(o, e) =>
{
LoadProperty(ScoreInfoProperty, e.Object);
OnPropertyChanged(ScoreInfoProperty.Name);
_loadingScore = false;
}
);
#else
LoadProperty(ScoreInfoProperty, Score.GetScore(
ReadProperty(ProfileIDProperty),
ReadProperty(PersonNameProperty),
ReadProperty(NicknameProperty),
ReadProperty(TeamIDProperty),
((TeamMemberInfoList)this.Parent).ParentTeam.Name));
#endif
}
return GetProperty(ScoreInfoProperty);
}
}