Uebungsaufgaben/Semester3/DotNET/Aufgabenblatt6/Aufgabe17/Views/MainWindow.xaml
2024-12-19 23:55:07 +01:00

61 lines
2.6 KiB
XML

<Window x:Class="Aufgabe17.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Aufgabe17.Views"
mc:Ignorable="d"
Title="Mitarbeiterverwaltung" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<!-- ListBox nimmt den oberen Teil ein -->
<RowDefinition Height="*" />
<!-- Buttons sind unten -->
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<!-- ListBox in der oberen Zeile -->
<ListBox Grid.Row="0" Margin="10" Name="EmployeeListBox"
ItemsSource="{Binding Models}"
SelectedItem="{Binding SelectedModel}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<!-- Name -->
<TextBlock>
<Run Text="Name: " FontWeight="Bold"/>
<LineBreak/>
<Run Text="{Binding Firstname}"/>
<Run Text="{Binding Lastname}"/>
</TextBlock>
<!-- Geschlecht -->
<TextBlock>
<Run Text="Geschlecht: " FontWeight="Bold"/>
<Run Text="{Binding Gender}"/>
</TextBlock>
<!-- Adresse -->
<TextBlock>
<Run Text="Adresse: " FontWeight="Bold"/>
<LineBreak/>
<Run Text="{Binding Address.Street}"/>
<Run Text="{Binding Address.StreetNumber}"/>
<LineBreak/>
<Run Text="{Binding Address.PostCode}"/>
<Run Text="{Binding Address.City}"/>
</TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- StackPanel in der unteren Zeile für die Buttons -->
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Hinzufügen" Width="100" Margin="5" Command="{Binding AddCommand}"/>
<Button Content="Entfernen" Width="100" Margin="5" Command="{Binding DeleteCommand}"/>
</StackPanel>
</Grid>
</Window>