简体   繁体   English

wp7,导航回该列表框时未填充约80个项目

[英]wp7, listbox of ~80 items not populating when navigating back to it

I think this has a lot to do with how I'm structuring my listbox in XAML and the data virtualization happening with the box itself, but I need some help being pointed in the correct direction. 我认为这与我在XAML中构建列表框的方式以及该框本身发生的数据虚拟化有很大关系,但是我需要向正确的方向指出一些帮助。

I currently have a pivot page with a listbox in the first page. 我目前有一个枢轴页面,第一页中有一个列表框。 When a user navigates to this pivot page with the listbox, the listbox is created in xaml by the following code: 当用户使用列表框导航到此枢纽页面时,将通过以下代码在xaml中创建列表框:

  <ListBox x:Name="objects">

       <ListBoxItem x:Name="item1">
            <StackPanel>
                <TextBlock/>
                <TextBlock/>
            </StackPanel>
       </ListBoxItem>

       <ListBoxItem x:Name="item2">
            <StackPanel>
                <TextBlock/>
                <TextBlock/>
            </StackPanel>
       </ListBoxItem>

       //So forth to ListBoxItem item80

       <ListBoxItem x:Name="item80">
            <StackPanel>
                <TextBlock/>
                <TextBlock/>
            </StackPanel>
       </ListBoxItem>

  </ListBox>

It takes about 2 seconds to navigate to this page with the 80 listbox items, and I can imagine that it's because it's rendering this information. 导航到包含80个列表框项的页面大约需要2秒钟,我可以想象这是因为它正在呈现此信息。 That is a different problem, and again I believe it is because of the XAML coding. 那是一个不同的问题,我再次相信是由于XAML编码。

When I click on a listboxitem, it goes to a new page of mine. 当我单击列表框项目时,它会转到我的新页面。 However, my problem is that when I scroll to, say, item80 and click on it, and then navigate back to the pivot/listbox page, the items are not visible until I scroll all the way back up, and then scroll back down again. 但是,我的问题是,当我滚动到例如item80并单击它,然后导航回到“透视图/列表框”页面时,这些项目直到我一直向上滚动然后再次向下滚动时才可见。 。

Is there a way to get around this? 有办法解决这个问题吗? They're static listbox items and nothing is being added or deleted from the list. 它们是静态列表框项,因此不会在列表中添加或删除任何内容。 All resources (such as any pictures) are in the phone by default and there is nothing external (web calls, etc) happening to gather resources. 默认情况下,所有资源(例如任何图片)都在电话中,并且没有任何外部事件(网络呼叫等)来收集资源。 Any suggestions are helpful with this. 任何建议都将对此有所帮助。

This May be a good start 这可能是一个好的开始

this blog helped me alot also. 这个博客也帮助了我很多。

i do understand what your saying, its really hard to tell whats going on though. 我确实理解您的意思,但是真的很难告诉发生了什么。 So i hope this will help you! 因此,我希望这会对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM