English 中文(简体)
WP7 向湖塔莱发表具有约束力的案文和形象
原标题:WP7 Issue binding text and image to Hub Tile

我试图把配对名称和图像装入湖塔里。 数据来自一个产出JSON的复印件。 我没有问题淡化数据,利用每个通道向我的班子补充数据。 这里的安排:

    // Deserialize home page data
    public void jsonHome_GetDataCompleted(object snder, DownloadStringCompletedEventArgs e)
    {
        NewReleasesCharts homeData = JsonConvert.DeserializeObject<NewReleasesCharts>(e.Result);

        foreach (FeaturedReleases release in homeData.results.featuredReleases)
        {
            int releaseID = release.id;
            string releaseName = release.name;
            string releaseImg = release.images.large.url;

            new ReleaseLarge()
            {
                url = releaseImg
            };
            new FeaturedReleases()
            {
                id = releaseID,
                name = releaseName
            };
        }

        this.listRelease.ItemsSource = homeData.results.featuredReleases;        
    }

我的课堂

public class NewReleasesCharts 
{
    //public Metadata metadata { get; set; }
    public ResultHome results = new ResultHome();
    public IEnumerator<ResultHome> GetEnumerator()
    {
        return this.results.GetEnumerator();
    }
}

public class ResultHome
{
    public List<FeaturedReleases> featuredReleases { get; set; }

    //public List<FeaturedCharts> featuredCharts { get; set; }
    //public List<TopDownloads> topdownloads { get; set; }
    //public List<MostPopularReleases> mostPopularReleases { get; set; }
    //public List<Components> components { get; set; }

    internal IEnumerator<ResultHome> GetEnumerator()
    {
        throw new NotImplementedException();
    }
}

public class FeaturedReleases
{
    public int id { get; set; }
    public string type { get; set; }
    public string name { get; set; }
    public string slug { get; set; }
    public ReleaseImage images { get; set; }
}

public class ReleaseImage
{
    //public ReleaseSmall small { get; set; }
    public ReleaseMedium medium { get; set; }
    public ReleaseLarge large { get; set; }
}

public class ReleaseLarge
{
    public int width { get; set; }
    public int height { get; set; }
    public string url { get; set; }
    public string secureUrl { get; set; }
}

页: 1

                    <ListBox Grid.Row="0" x:Name="listRelease">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <toolkit:WrapPanel Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <toolkit:HubTile Title="{Binding name}" Source="{Binding url}" Margin="10" />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

现在只有<代码> 姓名/代码”在湖 T上显示。 我认为,这是因为名称和形象是不同阶层的,但我没有找到解决办法。 得到帮助。

最佳回答

Source="{Binding img}"

你在模式中没有任何公有财产的名称是img

我 out着一lim,但如果有任何东西,你的约束力就应当大致如下:

Source="{Binding images.medium.url}"
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签