public override DataTemplate SelectTemplate(object item, DependencyObject container) { GeneratorTabItem selectedGenTabItem = (GeneratorTabItem)item; IGenerator selectedGen = selectedGenTabItem.Generator; switch (selectedGen.GenInfo.GenType) { case GeneratorTypes.BLACK: return(BlackGenTemplate); case GeneratorTypes.TEXT: return(TextGenTemplate); } return(base.SelectTemplate(item, container)); }
public GeneratorConfigViewModel() { SelectedTabIndex = 0; //DEBUG GeneratorTabItem myItem = new GeneratorTabItem { Header = "Black", Generator = new GeneratorBlack() { GenInfo = GeneratorTypes.BLACK.GetInfo() } }; TabItems.Add(myItem); // Add event handler myItem.Delete_Clicked += Delete_Tab; GeneratorTabItem myItem2 = new GeneratorTabItem { Header = "Text", Generator = new GeneratorText() { GenInfo = GeneratorTypes.TEXT.GetInfo() } }; TabItems.Add(myItem2); // Add event handler myItem2.Delete_Clicked += Delete_Tab; //END DEBUG }