Я нашел решение для моего случая. Я решил это с DataContext.
Решение:
Часть MainPage.cs:
if (App._loggedIn)
{
fbClient = new FacebookClient(App._accessToken);
fbClient.GetCompleted +=
(o, arg) =>
{
if (arg.Error == null)
{
var result = (IDictionary)arg.GetResultData();
// Get user name
this.userName = result["name"].ToString();
Dispatcher.BeginInvoke(() => this.DataContext = this);
}
else
{
MessageBox.Show(arg.Error.Message);
}
};
fbClient.GetAsync("/me", new Dictionary{{"fields","id,name,first_name,last_name,picture"} , {"access_token", App._accessToken}});
}
MainPage.xaml:
<TextBlock Grid.Column="1" Height="30" HorizontalAlignment="Left" Margin="0,6,0,0" Name="text_userName" Text="{Binding Path=UserName}" VerticalAlignment="Top" />