ListBox Shift-Click Multi-Select Anchor is not being set properly

守給你的承諾、 提交于 2019-12-01 19:07:30

I've figured out the resolution to this:

In order to solve this, you must set Focus to the item after changing the SelectedIndex:

if (SelectedIndex > 0) {
     SelectedIndex--;
     ListBoxItem item = ItemContainerGenerator.ContainerFromIndex(SelectedIndex) as ListBoxItem;
     item.Focus();
}

This is how you move the selection down in the list. However, you need to set focus to the item for the shift-click selection to recognize the item as the anchor.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!