原因は未だ不明なものの、内部で ListView.get_TopItem が null を返していると考えられる。
例外が発生した場合は EnsureVisible を二回呼び出してスクロールする。
https://osdn.net/ticket/browse.php?group_id=6526&tid=36219
Fixes:
1da38617 ("発言一覧の表示位置の固定に ListView.TopItem を使用する")
case ScrollLockMode.FixedToItem:
var topIndex = listScroll.TopItemStatusId != null ? tab.IndexOf(listScroll.TopItemStatusId.Value) : -1;
if (topIndex != -1)
- listView.TopItem = listView.Items[topIndex];
+ {
+ var topItem = listView.Items[topIndex];
+ try
+ {
+ listView.TopItem = topItem;
+ }
+ catch (NullReferenceException)
+ {
+ listView.EnsureVisible(listView.VirtualListSize - 1);
+ listView.EnsureVisible(topIndex);
+ }
+ }
break;
case ScrollLockMode.None:
default: