This commit is contained in:
fabjuuuh
2020-09-30 14:37:40 +02:00
parent 41e77ba16c
commit f777b583f5
6 changed files with 64 additions and 8 deletions

28
DokterApp/ITab.cs Normal file
View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
namespace DokterApp
{
public interface ITab
{
string Name { get; set; }
ICommand CloseCommand { get; }
event EventHandler CloseRequested;
}
public abstract class Tab : ITab
{
public string Name { get; set; }
public ICommand CloseCommand { get; }
public event EventHandler CloseRequested;
public Tab()
{
//CloseCommand =
}
}
}

View File

@@ -22,5 +22,6 @@ namespace DokterApp
{
InitializeComponent();
}
}
}

14
DokterApp/UserTab.cs Normal file
View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DokterApp
{
class UserTab : Tab
{
public UserTab()
{
Name = "Piet";
}
}
}

View File

@@ -7,14 +7,9 @@
mc:Ignorable="d"
Title="WindowTabs" Height="450" Width="800">
<Grid>
<TabControl>
<TabItem Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabControl x:Name="tabControl" Loaded="tabControl_Load">
</TabControl>
<Button Content="Button" HorizontalAlignment="Left" Margin="400,76,0,0" VerticalAlignment="Top" Click="Button_Click"/>
</Grid>
</Window>

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@@ -17,9 +18,26 @@ namespace DokterApp
/// </summary>
public partial class WindowTabs : Window
{
public TabControl tbControl;
public WindowTabs()
{
InitializeComponent();
}
private void tabControl_Load(object sender, RoutedEventArgs e)
{
this.tbControl = (sender as TabControl);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
TabItem newTabItem = new TabItem
{
Header = "Test",
};
newTabItem.Content = new UserControlForTab();
this.tbControl.Items.Add(newTabItem);
}
}
}

View File

@@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "..\Client\Client.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DokterApp", "..\DokterApp\DokterApp.csproj", "{B150F08B-13DA-4D17-BD96-7E89F52727C6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DokterApp", "..\DokterApp\DokterApp.csproj", "{B150F08B-13DA-4D17-BD96-7E89F52727C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution