Files
csharp-uebung/FahzeugWPF/MainWindow.xaml
2025-06-02 16:26:06 +02:00

33 lines
1.6 KiB
XML

<Window x:Class="FahzeugWPF.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:FahzeugWPF"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:MainWindowViewModel, IsDesignTimeCreatable=False}"
Title="{Binding Path=MainWindowTitle}" Height="450" Width="800">
<StackPanel>
<DataGrid x:Name="fahrzeugTabelle"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserSortColumns="True"
IsReadOnly="True"
AutoGenerateColumns="False"
ItemsSource="{Binding Path=Fahrzeuge}">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding Path=Id}"/>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}"/>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Command="{Binding ElementName=fahrzeugTabelle, Path=DataContext.LoeschenKommando}" CommandParameter="{Binding}">Löschen</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</Window>