protected override void OnItemsPanelChanged(ItemsPanelTemplate oldItemsPanel, ItemsPanelTemplate newItemsPanel) { // This is not the actual WrappableStackPanel that will be used as the ItemsPanel. // This is another instance, and I use the field only for existence, not reference. isWrappableStackPanel = (newItemsPanel.LoadContent() as WrappableStackPanel) != null; base.OnItemsPanelChanged(oldItemsPanel, newItemsPanel); }
private static Panel LoadPanelTemplate(ItemsPanelTemplate panelTemplate) { var panel = (Panel)panelTemplate.LoadContent(); panel.IsItemsHost = false; //set by ItemPanelTemplate, we need to reset it return panel; }