这是布局更改时记住gridlayout位置的正确方法吗? [英] Is this the right way to remember gridlayout position when layout change?

查看:93
本文介绍了这是布局更改时记住gridlayout位置的正确方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 


我有一个包含很多项目的gridlayout的列表视图。当用户将视图滚动到第50个项目,然后切换捕捉视图或填充+捕捉视图时,我希望第50个项目仍在视口中。我尝试了以下方法:


 


  function  layoutChanged(e){

....

var itemListControl = WinJS.UI.getControl(itemList);
var firstIndex;
itemListControl .firstVisible()。then( function (index){
firstIndex = index;
});
updateForLayout(itemListControl,e.layout);
itemListControl.ensureVisible(firstIndex);

...
}

解决方案

嗨路易斯,


您是否调试了这个,如果是,那么您有异常的行是什么?


-Jeff


Hi, 

I have a listview with gridlayout filled with many items. When the user scroll the view to the 50th item, then switch Snap view, or filled+snap view, I want the 50th item to still be in the viewport. I tried the following:

 

function layoutChanged(e) {

        ....

        var itemListControl = WinJS.UI.getControl(itemList);
        var firstIndex;
        itemListControl .firstVisible().then(function (index) {
            firstIndex = index;
        });
        updateForLayout(itemListControl , e.layout);
        itemListControl.ensureVisible(firstIndex);
      
        ...
}

解决方案

Hi Louis,

Did you debug this and if so, what was the line that you have the exception on?

-Jeff


这篇关于这是布局更改时记住gridlayout位置的正确方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆