<Window x:Class="WPF.SaveLoadXML.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPF.SaveLoadXML"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    Title="Window1" Height="300" Width="300">
    <StackPanel DataContext="{Binding SelectedItem,ElementName=gridEnvironments}">
            <Button x:Name="configSaveButton" Command="{Binding SaveCommand, Source={StaticResource xmlData}}" CommandParameter="{Binding ItemsSource, ElementName=gridEnvironments}" Content="Save">
                
            </Button>
            <Button x:Name="configValidateButton">
                <Image Source="../Resources/db.png" Width="16" Height="16"/>
            </Button>
        <Grid Height="Auto" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="250" MinWidth="180" />
                <ColumnDefinition Width="Auto" MinWidth="40" />
                <ColumnDefinition Width="*" MinWidth="180"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                    <RowDefinition MinHeight="25"/>
                </Grid.RowDefinitions>
                <Label x:Name="labelName" Grid.Row="0" Margin="5,0,5,0">
                    <TextBlock Text="Environment Name:" TextWrapping="Wrap" Foreground="Black" />
                </Label>
                <TextBox Grid.Row="1" x:Name="textName" Margin="5,0,5,0" Text="{Binding Path=Name, Mode=TwoWay}" />
                <Label x:Name="labelServerName" Grid.Row="2" Margin="5,0,5,0">
                    <TextBlock Text="DB Server Name:" TextWrapping="Wrap" Foreground="Black" />
                </Label>
                <TextBox Grid.Row="3" x:Name="textServerName" Margin="5,0,5,0" Text="{Binding Path=Servername, Mode=TwoWay}"/>
                <Label x:Name="labelUserName" Grid.Row="4" Margin="5,0,5,0">
                    <TextBlock Text="User Name:" TextWrapping="Wrap" Foreground="Black" />
                </Label>
                <TextBox Grid.Row="5" x:Name="textUserName" Margin="5,0,5,0" Text="{Binding Path=Username, Mode=TwoWay}"/>
                <Label x:Name="labelPassword" Grid.Row="6" Margin="5,0,5,0">
                    <TextBlock Text="Password:" TextWrapping="Wrap" HorizontalAlignment="Left" Foreground="Black" />
                </Label>
                <TextBox Grid.Row="5" x:Name="textPassword" Margin="5,0,5,0" Text="{Binding Path=Password, Mode=TwoWay}"/>
                <Label x:Name="labelDBName" Grid.Row="8" Margin="5,0,5,0">
                    <TextBlock Text="DB Name:" TextWrapping="Wrap" Foreground="Black" />
                </Label>
                <TextBox Grid.Row="9" x:Name="textDBName" Margin="5,0,5,0" Text="{Binding Path=Databasename, Mode=TwoWay}"/>
                <Label x:Name="labelServerType" Grid.Row="10" Margin="5,0,5,0">
                    <TextBlock Text="DB Server Type:" TextWrapping="Wrap" Foreground="Black" />
                </Label>
                <StackPanel Grid.Row="11" Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Center" >
                    <telerik:RadRadioButton Width="80" Height="22"  Margin="0 0 15 0" 
                                        HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsChecked="True" >
                        <telerik:RadRadioButton.Content>
                            <StackPanel Orientation="Horizontal" Margin="4 0">
                                <TextBlock Text="SQL" Foreground="#2b2b2d" FontSize="12"/>
                            </StackPanel>
                        </telerik:RadRadioButton.Content>
                    </telerik:RadRadioButton>
                    <telerik:RadRadioButton Width="80" Height="22" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                                            >
                        <telerik:RadRadioButton.Content>
                            <StackPanel Orientation="Horizontal" Margin="4 0">
                                <TextBlock Text="Oracle"   Foreground="#2b2b2d" FontSize="12"/>
                            </StackPanel>
                        </telerik:RadRadioButton.Content>
                    </telerik:RadRadioButton>
                </StackPanel>
                <Label x:Name="labelRootPath" Grid.Row="12" Margin="5,0,5,0">
                    <TextBlock Text="Root Path:" TextWrapping="Wrap" Foreground="Black" />
                </Label>
                <StackPanel Grid.Row="13" Margin="5,0,5,0" Orientation="Horizontal">
                    <TextBox x:Name="textPath" HorizontalAlignment="Left" Margin="0,0,5,0" Width="210" Text="{Binding Path=RootPath, Mode=TwoWay}"/>
                    <telerik:RadButton Width="25" HorizontalAlignment="Right" Command="{Binding BrowseCommand}" >
                        <telerik:RadButton.Content>
                            <TextBlock Text="..." />
                        </telerik:RadButton.Content>
                    </telerik:RadButton>
                </StackPanel>
            </Grid>
            <Grid Grid.Column="1">
                <StackPanel VerticalAlignment="Center" Margin="5,0,5,0">
                    <telerik:RadButton Width="85" Height="22" HorizontalContentAlignment="Left" VerticalContentAlignment="Center"   
                                        Command="{Binding AddCommand}">
                        <telerik:RadButton.Content>
                            <StackPanel Orientation="Horizontal" Margin="4,0,0,0" VerticalAlignment="Center">
                                <Image Source="../Resources/Add.png" Width="16" Height="16" />
                                <TextBlock Text="Add" Foreground="#2b2b2d" FontSize="12" Margin="9 0 0 0"/>
                            </StackPanel>
                        </telerik:RadButton.Content>
                    </telerik:RadButton>
                    <telerik:RadButton Width="85" Height="22" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Margin="0,5,0,0" Command="{Binding RemoveCommand}" 
                                       >
                        <telerik:RadButton.Content>
                            <StackPanel Orientation="Horizontal" Margin="4,0,0,0" VerticalAlignment="Center">
                                <Image Source="../Resources/Delete.png" Width="16" Height="16" />
                                <TextBlock Text="Remove" Foreground="#2b2b2d" FontSize="12" Margin="9 0"/>
                            </StackPanel>
                        </telerik:RadButton.Content>
                    </telerik:RadButton>
                </StackPanel>
            </Grid>
            <telerik:RadGridView local:GridViewSelectionBehaviour.SelectedIndex="0" Grid.Column="2" Height="Auto" Name="gridEnvironments" Width="Auto" ItemsSource="{Binding Source={StaticResource xmlData}}" />
        </Grid>
    </StackPanel>
</Window>
