C# 无法从JSON在flipview上显示图像

C# 无法从JSON在flipview上显示图像,c#,json,image,uwp,flipview,C#,Json,Image,Uwp,Flipview,我有这样一个JSON: 我想在flipview上显示“图像url”数据。但我有一个问题,flipview上只显示边框(图片不显示) XAML: <FlipView x:Name="listingImageFlipview" Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" Margin="20,0,0,0" Width="230" Height="160" VerticalAlignment="Center" HorizontalAlignmen

我有这样一个JSON:

我想在flipview上显示“图像url”数据。但我有一个问题,flipview上只显示边框(图片不显示)

XAML:

<FlipView x:Name="listingImageFlipview" Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" Margin="20,0,0,0" Width="230" Height="160" VerticalAlignment="Center" HorizontalAlignment="Left" BorderBrush="Black" BorderThickness="0.5" Background="{x:Null}">
                            <FlipView.ItemTemplate>
                                <DataTemplate>
                                    <Grid x:Name="content" Margin="0,0,0,0">
                                        <Border x:Name="coverBox" Width="230" Height="160">
                                            <Border.Background>
                                                <ImageBrush Stretch="Uniform" ImageSource="images/IP-placeholder.png"/>
                                            </Border.Background>
                                            <Image x:Name="cover" Source="{Binding ImageURL1}" HorizontalAlignment="Center" Stretch="UniformToFill" AutomationProperties.Name="{Binding ID}" ImageOpened="Image_ImageOpened" Loaded="cover_Loaded" Loading="cover_Loading"/>
                                        </Border>
                                    </Grid>
                                </DataTemplate>
                            </FlipView.ItemTemplate>
                        </FlipView>

代码:

试试看
{
字符串urlPath=”http://..../listings/“+listingIdDetail.Text+”.json?module=listings&page=1&token=3f63-dc43-c8d5-eb45-8cbf-b72d-9d98-800f”;
var httpClient=newhttpclient(newhttpclienthandler());
var值=新列表
{
};
HttpResponseMessage response=等待httpClient.GetAsync(urlPath);
response.EnsureSuccessStatusCode();
如果(!response.issucessStatusCode)
{
listingDetailLoading.IsActive=false;
请求异常();
}
string jsonText=await response.Content.ReadAsStringAsync();
JsonObject-JsonObject=JsonObject.Parse(jsonText);
JsonObject jsonData=JsonObject[“数据”].GetObject();
JsonObject groupObject1=jsonData.GetObject();
JsonArray jsonGallery=groupObject1[“gallery”].GetArray();
foreach(jsonGallery中的JsonValue groupValue1)
{
JsonObject groupObject3=groupValue1.GetObject();
string imageUrl=groupObject3[“image_url”]。GetString();
ListingClass fileImage=新建ListingClass();
fileImage.ImageURL1=imageUrl;
BitmapImage bmi=新的BitmapImage(新Uri(fileImage.ImageURL1));
图像=新图像();
image.Source=bmi;
listingImageFlipview.Items.Add(图像);
}

如何获取可以在flipview上显示的图像?

您可以将您的JSON作为文本共享吗?这是其中一个JSON的链接:imageUrl的内容是什么?您解析JSON了吗?imageUrl来自“image_url”数据,我的imageUrl代码是string imageUrl=groupObject3[“image_url”]。GetString();ListingClass fileImage=new ListingClass();fileImage.ImageURL1=imageUrl;BitmapImage bmi=new BitmapImage(新Uri(fileImage.ImageURL1));Image=new Image();image.Source=bmi;是的,但分配它时实现了吗?调试器是怎么说的?
try
                {
                    string urlPath = "http://..../listings/" + listingIdDetail.Text + ".json?module=listings&page=1&token=3f63-dc43-c8d5-eb45-8cbf-b72d-9d98-800f";
                    var httpClient = new HttpClient(new HttpClientHandler());

                    var values = new List<KeyValuePair<string, string>>
                    {

                    };

                    HttpResponseMessage response = await httpClient.GetAsync(urlPath);
                    response.EnsureSuccessStatusCode();

                    if (!response.IsSuccessStatusCode)
                    {
                        listingDetailLoading.IsActive = false;
                        RequestException();
                    }

                    string jsonText = await response.Content.ReadAsStringAsync();
                    JsonObject jsonObject = JsonObject.Parse(jsonText);
                    JsonObject jsonData = jsonObject["data"].GetObject();

                    JsonObject groupObject1 = jsonData.GetObject();

                    JsonArray jsonGallery = groupObject1["gallery"].GetArray();
                    foreach (JsonValue groupValue1 in jsonGallery)
                    {
                        JsonObject groupObject3 = groupValue1.GetObject();

                        string imageUrl = groupObject3["image_url"].GetString();

                        ListingClass fileImage = new ListingClass();
                        fileImage.ImageURL1 = imageUrl;
                        BitmapImage bmi = new BitmapImage(new Uri(fileImage.ImageURL1));
                        Image image = new Image();
                        image.Source = bmi;

                        listingImageFlipview.Items.Add(image);
                    }