开发者

How to scroll an Surface LibraryBar item into view?

using WPF4 and Surface Toolkit 1.5 Bet开发者_Python百科a I am adding items to a LibraryBar in a button click handler. I would like to have the LibraryBar scroll to the latest added item, like in this pseudo-code (Shortcut is a data class of my project):

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();

Sadly, there is no such ScrollIntoView method in a LibraryBar. Also, I did not find a way to get the container framework element of an item to call a BringIntoView method. Is there any workaround for this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜