<UserControl x:Class="CtrEditor.Siemens.PLCControl"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:CtrEditor.Siemens">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>

        <Label Content="IP:" Grid.Row="0" Grid.Column="0" Margin="1" VerticalAlignment="Center"/>
        <TextBox Text="{Binding IP, UpdateSourceTrigger=PropertyChanged}" 
                 Grid.Row="0" Grid.Column="1" Margin="1" VerticalAlignment="Center"/>

        <Label Content="Name:" Grid.Row="1" Grid.Column="0" Margin="1" VerticalAlignment="Center"/>
        <TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" 
                 Grid.Row="1" Grid.Column="1" Margin="1" VerticalAlignment="Center"/>

        <Button Content="Connect" Command="{Binding ConnectCommand}"
                Grid.Row="2" Grid.Column="0" Margin="1" VerticalAlignment="Center"/>
        <Button Content="Disconnect" Command="{Binding DisconnectCommand}"
                Grid.Row="2" Grid.Column="1" Margin="1" VerticalAlignment="Center"/>

        <Label Content="CPU cycle:" Grid.Row="3" Grid.Column="0" Margin="1" VerticalAlignment="Center"/>
        <Label Content="{Binding CpuTime}" Grid.Row="3" Grid.Column="1" Margin="1" VerticalAlignment="Center"/>
        <Label Grid.Row="4" Grid.Column="0" Margin="1" VerticalAlignment="Center">
            Last Error:
        </Label>
        <Label Grid.Row="4" Grid.Column="1" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Stretch">
            <TextBlock Text="{Binding LastError}" TextWrapping="Wrap" Padding="3"/>
        </Label>

    </Grid>
</UserControl>