silverlight - Adding new tabs to TabControl -


what want in example make first tab of tabcontrol disappear , add 2 new tabs dynamically. new tabs appear 'header' not showing:

            itemcollection ic = this.tabcontrol1.items;             tabitem firsttab = (tabitem)ic[0];             firsttab.visibility = visibility.collapsed;              tabitem newtab = new tabitem();             newtab.headertemplate = firsttab.headertemplate;             newtab.header = newtab.name = "test1";             ic.add(new tabitem());              newtab = new tabitem();             newtab.headertemplate = firsttab.headertemplate;             newtab.template = firsttab.template;             newtab.contenttemplate = firsttab.contenttemplate;             newtab.header = newtab.name = "test2";             ic.add(new tabitem()); 

replace both ic.add(new tabitem()); ic.add(newtab)

like this:

tabitem newtab = new tabitem(); newtab.headertemplate = firsttab.headertemplate; newtab.header = newtab.name = "test1"; ic.add(newtab);  newtab = new tabitem(); newtab.headertemplate = firsttab.headertemplate; newtab.template = firsttab.template; newtab.contenttemplate = firsttab.contenttemplate; newtab.header = newtab.name = "test2"; ic.add(newtab); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -