<ContentDialog
    x:Class="JumpPoint.Uwp.Dialogs.RenameDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:JumpPoint.Uwp.Dialogs"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="using:JumpPoint.ViewModels.Dialogs"
    mc:Ignorable="d"
    Title="Rename"
    PrimaryButtonText="Rename"
    CloseButtonText="Cancel"
    DefaultButton="Primary"
    IsPrimaryButtonEnabled="{x:Bind ViewModel.IsValid, Mode=OneWay}">

    <ContentDialog.Resources>
        <Style TargetType="local:RenameDialog"
               BasedOn="{StaticResource DefaultContentDialogStyle}" />
    </ContentDialog.Resources>

    <StackPanel>
        <TextBlock Text="{x:Bind ViewModel.OldName, Converter={StaticResource StringFormatConverter}, ConverterParameter='Old name: {0}'}"
                   TextWrapping="WrapWholeWords"/>
        <TextBox Header="New name:" Margin="0,4"
                 Text="{x:Bind ViewModel.NewName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <Grid Margin="0,4">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock Text="Action if name already exists:" Margin="0,0,0,4" />
            <ComboBox Grid.Row="1"
                      PlaceholderText="Pick an action"
                      ItemsSource="{x:Bind ViewModel.Actions, Mode=OneWay}"
                      SelectedItem="{Binding Action, Mode=TwoWay}"
                      IsEnabled="{x:Bind ViewModel.IsMultiple, Mode=OneWay, Converter={StaticResource NegateBooleanConverter}}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Converter={StaticResource HumanizerConverter}}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBlock Grid.Row="2" Margin="0,4"
                       Text="Renaming multiple items will always use the generate unique name action."
                       Visibility="{x:Bind ViewModel.IsMultiple, Mode=OneWay, Converter={StaticResource VisibleWhenTrueConverter}}"/>
            <TextBlock Grid.Row="3" Margin="0,4"
                       Text="Renaming Workspaces will always use the generate unique name action."
                       Visibility="{x:Bind ViewModel.IsMultiple, Mode=OneWay, Converter={StaticResource VisibleWhenTrueConverter}}"/>
        </Grid>
    </StackPanel>
</ContentDialog>
