How to call a window using tabcontrol in wpf -


i have main_window runs base.

it has buttons on left side.

if button1 clicked, need window ( defined separately login) open tabcontrol in main_window (located @ center).

so each time when click 1 of buttons, corresponding windows should shown tabs in main window.

hoping right answer... thank you.

try

xaml:

   <window x:class="test1.mainwindow"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         title="mainwindow" height="350" width="525">     <grid>         <grid.columndefinitions>             <columndefinition width="134*" />             <columndefinition width="369*" />         </grid.columndefinitions>          <grid grid.column="0">             <button content="login" height="23" horizontalalignment="left" margin="24,28,0,0" name="button1" verticalalignment="top" width="75" click="button1_click" />         </grid>          <grid grid.column="1">             <tabcontrol name="tabcontrol"/>          </grid>      </grid> </window> 

c#:

namespace test1 {     /// <summary>     /// interaktionslogik für mainwindow.xaml     /// </summary>     public partial class mainwindow : window     {         public mainwindow()         {             initializecomponent();         }          private void button1_click(object sender, routedeventargs e)         {              tabitem item = new tabitem();             item.header = "some header";             //item.content = < content>              tabcontrol.items.add(item);           }     } } 

Comments