<UserControl x:Class="CustomerControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="400">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <DockPanel Margin="0,5,0,3" Grid.Row="0" Grid.ColumnSpan="2">
            <TextBlock DockPanel.Dock="Top" Padding="0,4,0,4">Orders:</TextBlock>
            <!-- These buttons allow adding, editing, and removing orders. -->
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom">
                <Button Width="70" Margin="0,2,1,2" Click="addOrder">Add</Button>
                <Button Width="70" Margin="1,2,2,1" Click="editOrder">Edit</Button>
                <Button Width="70" Margin="1,2,2,1" Click="deleteOrder">Delete</Button>
            </StackPanel>
            <!-- A DataGrid showing orders. -->
            <DataGrid x:Name="ordersGrid" GridLinesVisibility="None" MouseDoubleClick="orderDoubleClick" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="ID" Binding="{Binding OrderID}" Width="50"/>
                    <DataGridTextColumn Header="Order Date" Binding="{Binding OrderDate}" Width="150"/>
                    <DataGridTextColumn Header="Freight" Binding="{Binding Freight}"/>
                    <DataGridTextColumn Header="Ship Name" Binding="{Binding ShipName}"/>
                    <DataGridTextColumn Header="Ship City" Binding="{Binding ShipCity}"/>
                </DataGrid.Columns>
            </DataGrid>
        </DockPanel>

        <!-- Undo Changes and Close buttons. -->
        <StackPanel Grid.Row="1" HorizontalAlignment="Right" Margin="3" Orientation="Horizontal" Grid.ColumnSpan="2">
            <Button Width="93" Margin="2" x:Name="buttonUndo" Click="undo_Click">Undo Changes</Button>
            <Button Width="70" Margin="2" Click="close_Click">Close</Button>
        </StackPanel>
    </Grid>
</UserControl>
