I have a Silverlight ModelViewViewModel project that I would like to expose a property on the view model to a UserControl like:
public DTO.Client Client
{
get { return client; }
}
client is a private backing variable that I set in a async completed event handler:
void GetClientByIDComplete(object sender, GetClientByIDCompletedEventArgs e)
{
Application.Current.RootVisual.Dispatcher.BeginInvoke(() =>
{
DTO.Client c = new ServiceContract.DTO.Client();
c = e.Result as DTO.Client;
client = e.Result as DTO.Client;
});
}
In my Silverlight page I have the following:
<TextBlock Text="{Binding Client.Name}"/>
The data never is displayed. The data is displayed if I change the property to:
public DTO.Client Client
{
get {
client.Name = "My Name";
return client; }
}
This way I explicitly assign the value.
What do I have to change so the property is seen by my page?