<Window x:Class="SharepointToolbox.Views.Dialogs.ProfileManagementDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:loc="clr-namespace:SharepointToolbox.Localization"
        Title="Manage Profiles" Width="500" Height="480"
        WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
        ResizeMode="NoResize">
  <Grid Margin="12">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <!-- Profile list -->
    <Label Content="Profiles" Grid.Row="0" />
    <ListBox Grid.Row="1" Margin="0,0,0,8"
             ItemsSource="{Binding Profiles}"
             SelectedItem="{Binding SelectedProfile}"
             DisplayMemberPath="Name" />

    <!-- Input fields -->
    <Grid Grid.Row="2" Margin="0,0,0,8">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="100" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <Label Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[profile.name]}"
             Grid.Row="0" Grid.Column="0" />
      <TextBox Text="{Binding NewName, UpdateSourceTrigger=PropertyChanged}"
               Grid.Row="0" Grid.Column="1" Margin="0,2" />
      <Label Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[profile.url]}"
             Grid.Row="1" Grid.Column="0" />
      <TextBox Text="{Binding NewTenantUrl, UpdateSourceTrigger=PropertyChanged}"
               Grid.Row="1" Grid.Column="1" Margin="0,2" />
      <Label Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[profile.clientid]}"
             Grid.Row="2" Grid.Column="0" />
      <TextBox Text="{Binding NewClientId, UpdateSourceTrigger=PropertyChanged}"
               Grid.Row="2" Grid.Column="1" Margin="0,2" />
    </Grid>

    <!-- Buttons -->
    <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
      <Button Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[profile.add]}"
              Command="{Binding AddCommand}" Width="60" Margin="4,0" />
      <Button Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[profile.rename]}"
              Command="{Binding RenameCommand}" Width="60" Margin="4,0" />
      <Button Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[profile.delete]}"
              Command="{Binding DeleteCommand}" Width="60" Margin="4,0" />
      <Button Content="Close" Width="60" Margin="4,0"
              Click="CloseButton_Click" IsCancel="True" />
    </StackPanel>
  </Grid>
</Window>
