2012-04-28 7 views
0

私は、その中に画像のリストを持つクラスを持っています。Windows PhoneバインドリストボックスListbbxを使用

public class RSSClass 
{ 
public string Title { get; set; } 
public string Summary { get; set; } 
public string PubDate { get; set; } 
public List<ImageData> ImagePath { get; set; } 

public class ImageData 
{ 
    public Uri ImageLocation 
    { 
     get; 
     set; 
    } 
} 
} 

レディースXAML

  <ListBox Name="lstRSS"> 
       <ListBox.ItemTemplate> 
        <DataTemplate> 
         <StackPanel> 
          <StackPanel.Resources> 
          </StackPanel.Resources> 
          <TextBlock Text="{Binding Path=Title}"> </TextBlock> 
          <TextBlock Text="{Binding Path=PubDate}"></TextBlock> 
          <TextBlock Text="{Binding Path=Summary}"></TextBlock> 
          <ListBox x:Name="ImageListBox" ItemsSource="{Binding ImagePath}"> 
            <DataTemplate> 
             <Image x:Name="image1" Source="{Binding}" MaxHeight="80" MaxWidth="120" Margin="0"></Image> 
            </DataTemplate> 
          </ListBox> 
         </StackPanel> 
        </DataTemplate> 
       </ListBox.ItemTemplate> 
      </ListBox> 

内側リストボックス、ImageListBoxは、ウリの文字列値を結合して示します。 Imは内側のリストボックスimage1にある画像を何にバインドするのか分かりません。

ご迷惑をおかけして申し訳ございません。

よろしく ロス

+0

Source = "{Binding ImageLocation}"を試しましたか? –

+0

その仲間を試してみました、運がない、提案に感謝! – user746585

+0

UriではなくImageLocationとして文字列を使用しようとしましたか? –

答えて

1

あなたの<DataTemplate>周り<ListBox.ItemTemplate>が欠落しています。これはListBoxを混乱させるので、実際にはテンプレートではなくアイテムであると考えられます。

+0

Thats for the suggestion Euphoric。リストボックスにはいくつかのバインディングがあり、リストボックスにはいくつかの "RSSClass + ImageData"文字列が含まれていますが、削除すると何も表示されません。リストボックスはオブジェクトにバインドされているようです内部に。 – user746585

+0

正しく追加しましたか?DataTemplateが指定されていない場合に記述されているので、オブジェクトのToStringにバインドされます。 – Euphoric

0

@ Euphoricの解像度を実装したら、image1のソースをImageLocationにバインドします。例:

<Image x:Name="image1" Source="{Binding ImageLocation}" MaxHeight="80" MaxWidth="120" Margin="0"></Image> 
関連する問題