/// <summary> /// Standard ListBox method to return item containers (which are always LazyListBoxItems for us) /// </summary> /// <returns>Returns a new LazyListBoxItem</returns> protected override DependencyObject GetContainerForItemOverride() { LazyListBoxItem item = new LazyListBoxItem(); item.Owner = this; if (ItemContainerStyle != null) item.Style = ItemContainerStyle; return item; }
/// <summary> /// Gets the index of the item housed by the given container /// </summary> /// <param name="container">The container to check</param> /// <returns>The index of the item that is housed in this container</returns> public int GetItemIndexFromContainer(LazyListBoxItem container) { return (stackPanel.ItemContainerGenerator as ItemContainerGenerator).IndexFromContainer(container); }