Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add buttons on different tabs using TabControl in WPF
    text
    copied!<p>I have the basic tabs made and I want each tab to have a different set of buttons, but the button is added to the main window and no the tab. When i go to the code and cut the button and paste it to the tab I want it to be, it works but only for 1 button, then for the second button I get an error message:</p> <p>"The object <code>TabItem</code> already has a child and cannot add <code>Button.TabItem</code> can accept only one child."</p> <p>This is how the code looks like:</p> <pre><code>xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="394" Width="570"&gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="0*" /&gt; &lt;ColumnDefinition Width="548*" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TabControl Margin="9,30,11,10" Name="tabControl1" Grid.Column="1" SelectionChanged="tabControl1_SelectionChanged"&gt; &lt;TabItem Name="Admin" Header="Admin"&gt; &lt;/TabItem&gt; &lt;TabItem Name="Staff" Header="Staff" /&gt; &lt;TabItem Name="Student" Header="Student" /&gt; &lt;TabItem Name="Diary" Header="Diary" /&gt; &lt;TabItem Name="Timetables" Header="Timetables" /&gt; &lt;TabItem Name="Assignments" Header="Assignments" /&gt; &lt;TabItem Name="Courses" Header="Courses" /&gt; &lt;/TabControl&gt; &lt;Menu Height="16" Name="menu1" VerticalAlignment="Top" Grid.Column="1" /&gt; &lt;Button Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="18,64,0,0" Name="button1" VerticalAlignment="Top" Width="118"&gt;Add/Edit Student&lt;/Button&gt; &lt;/Grid&gt; </code></pre> <p>I want to implement the "button1" inside of the "Admin" tab</p> <p>It works but it fails when I do a second button</p> <p>Thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload