すべての xbox ライブ フレンド情報を示す XML ドキュメントから情報を取得しようとしています。私が今やりたいことは、動的に作成された画像コントロールにアバターを表示することですが、実際にその画像をアプリグリッドに表示する方法がわかりません。
これまでのところ、ゲーマータグを使用して動的コントロールを作成し、それにカスタム テキストを追加しようとしました。これまでのコードは次のとおりです。
string gamertag, avatarURL;
foreach (XElement elm in doc.Descendants().Elements("Friends"))
{
gamertag = elm.Element("Gamertag").Value;
avatarURL = elm.Element("AvatarLarge").Value;
Image friendimage = new Image();
friendimage.Name = gamertag.ToString() + "ImageControl";
BitmapImage AccountPicbitmap = new BitmapImage();
AccountPicbitmap.UriSource = new Uri(avatarURL);
friendimage.Source = AccountPicbitmap;
//Some code to display this control with the avatar image using the URL retrieved, I want to play these tiles side by side
}
これを行う方法について何か提案はありますか? 前もって感謝します!
更新: このコントロールを XAML に追加しましたが、奇妙な例外がいくつか発生しています: System.Runtime.Remoting.RemotingException [7756] Designer プロセスが予期せず終了しました!
<ItemsControl HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="1249" Margin="55,484,0,0" ItemsSource="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding avatarURL}" Name="{Binding GamerTag}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
アプリをデバッグすると、無限ループに入り、初期化でも例外がスローされます
public MainPage()
{
this.InitializeComponent();
}