クラスのインスタンスを C# の ListBox にバインドしようとしています。
私の MainPage.xaml.cs で
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (fan == null)
fan = (Fanfou)e.Parameter;
RefreshHomeTimeLine(fan.oauth_token, fan.oauth_token_secret);
}
private async void RefreshHomeTimeLine(string access, string access_secret)
{
string text=await fan.getFanfouApi("http://api.fanfou.com/statuses/home_timeline.json", access, access_secret);
fanfouHomeTL = JsonConvert.DeserializeObject<FanfouHTL>(text);
}
fanfouHomeTL は良好で、ステータスのコレクションが含まれていました。
そのクラスの宣言は次のとおりです。
public class FanfouHTL
{
private ObservableCollection<Status> statuses;
public ObservableCollection<Status> Statuses
{
get
{
return statuses;
}
set
{
statuses = value;
}
}
}
今、私はそのインスタンスをListBox
(グリッド内の) にバインドしようとしていますMainPage.xaml
。私はすでにそのために作成ItemTemplate
しましたListBox
。DataContext
グリッドの をFanfouHTL
(クラス)に入れると、には何も表示されないようListBox
です。DC をfanfouHomeTL
(インスタンス)に設定すると、でMainPage
失敗しInitializeComponent
ます。
どんなヒントでも大歓迎です。