使用 WPF4 和 Surface Toolkit 1.5 Beta 我在按钮单击处理程序中将项目添加到 LibraryBar。我想让 LibraryBar 滚动到最新添加的项目,就像在这个伪代码中一样(快捷方式是我项目的数据类):
private ObservableCollection<Shortcut> _items;
/* ... */
_items = new ObservableCollection<Shortcut>();
this.theShortcutLibraryBar.ItemsSource = _items;
/* ... */
Shortcut s = new Shortcut(description, transform);
_items.Add(s);
/* Version 1 */
this.theShortcutLibraryBar.ScrollIntoView(s);
/* Version 2 */
this.theShortcutLibraryBar.GetContainerElement(s).BringIntoView();
遗憾的是,LibraryBar 中没有这样的 ScrollIntoView 方法。此外,我没有找到一种方法来让项目的容器框架元素调用 BringIntoView 方法。有什么解决方法吗?