In the code below, the UnitOccupierDetails collection binds correctly but the OwnersCountString doesn't. Can anyone explain why? This code is in my ViewModel:
private void BindSelectedStructure(object param)
{
UnitOccupierDetails.Clear();
Structure selectedStructure = (Structure)param;
this.SelectedStructure = selectedStructure;
int StructureID = selectedStructure.IDStructure;
loadOwners = context.Load<UserOccupier>(context.GetUnitOccupierDetailsQuery(StructureID), OwnersLoadedCallback, false);
}
private void OwnersLoadedCallback(LoadOperation<UserOccupier> op)
{
int Counter = 0;
foreach (var item in op.Entities)
{
Counter++;
UnitOccupierDetails.Add(item as UserOccupier);
}
OwnersCountString = "Owners(" + Counter.ToString() + ")";
}
And the XAML:
<TextBlock Text='{Binding OwnersCountString,Source={StaticResource ViewModel},Mode=OneWay}'></TextBlock
OwnersCountStringProperty:
private string _ownersCountString;
public string OwnersCountString
{
get { return _ownersCountString; }
set { _ownersCountString = value; RaisePropertyChanged("OwnersCountString"); }
}