Image Windows Phone在带有绑定的列表框中显示RSS图像

Image Windows Phone在带有绑定的列表框中显示RSS图像,image,binding,rss,windows-phone,Image,Binding,Rss,Windows Phone,我无法使用绑定将提要中的RSS图像显示在我的列表框中 MainWindow.xaml: <ListBox Grid.Row="1" Name="feedListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionChanged="feedListBox_SelectionChanged"> <ListBox.ItemTemplate>

我无法使用绑定将提要中的RSS图像显示在我的列表框中

MainWindow.xaml:

<ListBox Grid.Row="1" Name="feedListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionChanged="feedListBox_SelectionChanged">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Border 
                    Width="110" Height="110">
                                    <Image Source="{Binding FeedData}" Stretch="UniformToFill"
                       AutomationProperties.Name="{Binding Title}"/>
                                </Border>
                                <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
                                    <TextBlock TextDecorations="Underline" Foreground="Green" FontSize="24" Name="feedTitle" TextWrapping="Wrap" Margin="12,0,0,0" Text="{Binding Title.Text, Converter={StaticResource RssTextTrimmer}}" />
                                    <TextBlock Name="feedSummary" TextWrapping="Wrap" Margin="12,0,0,0" Text="{Binding Summary.Text, Converter={StaticResource RssTextTrimmer}}"/>
                                    <TextBlock Name="feedPubDate" Foreground="DarkGray" Margin="12,0,0,10" Text="{Binding PublishDate, StringFormat='{}{0:dd/MM/yyyy HH:mm:ss}'}" />
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
下面是获取图像的代码:

public class FeedData
{
    private List<FeedItem> _Items = new List<FeedItem>();
    public List<FeedItem> Items
    {
        get
        {
            return this._Items;
        }
    }
}

public class FeedItem
{
    //public string Title { get; set; }
    //public string Content { get; set; }
    //public DateTime PubDate { get; set; }
    //public Uri Link { get; set; }
    public Uri Image { get; set; }
}
MainWindow.cs:

private void UpdateFeedList(string feedXML)
    {
        StringReader stringReader = new StringReader(feedXML);
        XmlReader xmlReader = XmlReader.Create(stringReader);
        SyndicationFeed feed = SyndicationFeed.Load(xmlReader);
        FeedItem feedItem = new FeedItem();

        foreach (SyndicationItem item in feed.Items)
        {

            foreach (SyndicationLink enclosure in item.Links.Where<SyndicationLink>(x => x.RelationshipType == "enclosure"))
            {
                Uri url = enclosure.Uri;
                long length = enclosure.Length;
                string mediaType = enclosure.MediaType;
                feedItem.Image = url;
            }
        }

        Deployment.Current.Dispatcher.BeginInvoke(() =>
        {

            feedListBox.ItemsSource = feed.Items;


        });

    }
以及存储/检索图像的类:

public class FeedData
{
    private List<FeedItem> _Items = new List<FeedItem>();
    public List<FeedItem> Items
    {
        get
        {
            return this._Items;
        }
    }
}

public class FeedItem
{
    //public string Title { get; set; }
    //public string Content { get; set; }
    //public DateTime PubDate { get; set; }
    //public Uri Link { get; set; }
    public Uri Image { get; set; }
}

我认为是我做错了,我希望有人能帮助我。谢谢。

我通过将绑定更改为以下内容找到了解决方案:

Binding Links[1].Uri

您的图像源设置为source={Binding FeedData},而不是url?我已经解决了这个问题,但谢谢。请将您的解决方案作为答案发布,@Thunder!:当然,我发布了我的解决方案。