<rename:InlineRenameAdornment x:Class="Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.RenameDashboard"
             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" 
             xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
             xmlns:imagecatalog="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.ImageCatalog"
             xmlns:rename="clr-namespace:Microsoft.CodeAnalysis.Editor.Implementation.InlineRename"
             x:ClassModifier="internal"
             mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"
             MinWidth="300"
             Cursor="Arrow"
             Focusable="True"
             x:Name="dashboard"
             AutomationProperties.AutomationId="Microsoft.CodeAnalysis.EditorFeatures.InlineRenameDialog" 
             UseLayoutRounding="True">
    <!-- 
        !!!IMPORTANT!!! 
        The automation string of this dialog, "Microsoft.CodeAnalysis.EditorFeatures.InlineRenameDialog", 
        is being used by 3rd parties to assist in a better inline rename experience for screen readers. 
        Do not change this automation id.
    -->

    <rename:InlineRenameAdornment.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../InlineRenameColors.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

            <SolidColorBrush x:Key="ForegroundText" Color="{DynamicResource {x:Static rename:InlineRenameColors.SystemCaptionTextColorKey}}"/>

            <Style TargetType="CheckBox">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static rename:InlineRenameColors.CheckBoxTextBrushKey}}"/>
            </Style>

            <Style TargetType="TextBlock">
                <Setter Property="Foreground" Value="{StaticResource ForegroundText}"/>
            </Style>

            <Path
            x:Key="XShapePath"
            Width="10"
            Height="8"
            Fill="{StaticResource ForegroundText}"
            Stretch="Uniform"
            Data="F1 M 0,0L 2,0L 5,3L 8,0L 10,0L 6,4L 10,8L 8,8L 5,5L 2,8L 0,8L 4,4L 0,0 Z" />
        </ResourceDictionary>
    </rename:InlineRenameAdornment.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>

        <Border Grid.Row="0" BorderBrush="Transparent"
            Background="{DynamicResource {x:Static rename:InlineRenameColors.BackgroundBrushKey}}"  
            BorderThickness="0" 
            Padding="7">
            <StackPanel>

                <!-- Heading: Display the old and new identifier names, and an indication if something is wrong (but not the full description, which goes in the Summary section below) -->

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <Grid>
                        <imaging:CrispImage Grid.Row ="0" Grid.Column="0" Height="16" Width="16" Margin="0,0,4,0" VerticalAlignment="Center">
                            <imaging:CrispImage.Style>
                                <Style TargetType="imaging:CrispImage">
                                    <Setter Property="Visibility" Value="Collapsed"/>

                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=Severity}" Value="Error">
                                            <Setter Property="Visibility" Value="Visible"/>
                                            <Setter Property="Moniker" Value="{x:Static imagecatalog:KnownMonikers.StatusError}"/>
                                        </DataTrigger>

                                        <DataTrigger Binding="{Binding Path=Severity}" Value="Info">
                                            <Setter Property="Visibility" Value="Visible"/>
                                            <Setter Property="Moniker" Value="{x:Static imagecatalog:KnownMonikers.StatusInformation}"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </imaging:CrispImage.Style>
                        </imaging:CrispImage>
                    </Grid>

                    <TextBlock Grid.Row="0"
                               Grid.Column="1"
                               Text="{Binding HeaderText}"
                               FontWeight="Bold"
                               TextTrimming="CharacterEllipsis"
                               FontSize="14"
                               MaxWidth="260"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Left"
                               ToolTip="{Binding Session.OriginalSymbolName, Mode=OneTime}"/>
                    <Button 
                    Name="CloseButton"
                    Grid.Row ="0"
                    Grid.Column="2"
                    Width="18" Height="18"
                    Margin="4,0,0,0"
                    Content="{StaticResource ResourceKey=XShapePath}"
                    Background="Transparent"
                    BorderThickness="0"
                    VerticalAlignment="Center"
                    HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                    Click="CloseButton_Click"
                    ToolTip="{Binding ElementName=dashboard, Path=CancelToolTip}"
                    AutomationProperties.Name="{Binding ElementName=dashboard, Path=CancelRename}"/>
                </Grid>

                <!-- Display the new name if it has been adjusted, or instructional text if it has not. -->

                <TextBlock Text="{Binding NewNameDescription}"
                           MaxWidth="280"
                           TextTrimming="CharacterEllipsis"
                           Padding="0,3,0,12"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Left"
                           Visibility="{Binding ShouldShowNewName, Converter={StaticResource BooleanToVisibilityConverter}}"/>

                <TextBlock Name="Instructions" 
                           Text="{Binding ElementName=dashboard, Path=RenameInstructions}" 
                           Padding="0,3,0,12"
                           TextWrapping="Wrap" 
                           Width="Auto"
                           FontStyle="Italic"
                           Visibility="{Binding ShouldShowInstructions, Converter={StaticResource BooleanToVisibilityConverter}}"/>

                <!-- Settings -->

                <CheckBox Content="{Binding ElementName=dashboard, Path=RenameOverloads}" Margin="0,0,0,0" IsChecked="{Binding Path=DefaultRenameOverloadFlag, Mode=TwoWay}"
                      Name="OverloadsCheckbox" Visibility="{Binding ElementName=dashboard, Path=RenameOverloadsVisibility}" IsEnabled="{Binding ElementName=dashboard, Path=IsRenameOverloadsEditable}" />
                <CheckBox Name="CommentsCheckbox" Content="{Binding ElementName=dashboard, Path=SearchInComments}" Margin="0,0,0,0" IsChecked="{Binding Path=DefaultRenameInCommentsFlag, Mode=TwoWay}" />
                <CheckBox Name="StringsCheckbox" Content="{Binding ElementName=dashboard, Path=SearchInStrings}" Margin="0,0,0,0" IsChecked="{Binding Path=DefaultRenameInStringsFlag, Mode=TwoWay}" />
                <CheckBox Name="FileRenameCheckbox" 
                          Content="{Binding Path=FileRenameString}" 
                          Margin="0" 
                          IsChecked="{Binding Path=DefaultRenameFileFlag, Mode=TwoWay}" 
                          IsEnabled="{Binding Path=AllowFileRename, Mode=OneWay}" 
                          Visibility="{Binding Path=ShowFileRename, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}"/>

                <CheckBox Name="PreviewChangesCheckbox" Content="{Binding ElementName=dashboard, Path=PreviewChanges}" Margin="0,8,0,0" IsChecked="{Binding Path=DefaultPreviewChangesFlag, Mode=TwoWay}" />

                <!-- Summary: Includes the number of references to be updated and any conflict information -->

                <TextBlock Text="{Binding Path=SearchText}"
                           Margin="0,12,0,0"/>

                <StackPanel Margin="0,8,0,0">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <Setter Property="Visibility" Value="Collapsed"/>

                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Path=Severity}" Value="Error">
                                    <Setter Property="Visibility" Value="Visible"/>
                                </DataTrigger>

                                <DataTrigger Binding="{Binding Path=Severity}" Value="Info">
                                    <Setter Property="Visibility" Value="Visible"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </StackPanel.Style>
                    <Grid>
                        <Grid.Style>
                            <Style TargetType="Grid">
                                <Setter Property="Visibility" Value="Collapsed"/>

                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=HasResolvableConflicts}" Value="True">
                                        <Setter Property="Visibility" Value="Visible"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Grid.Style>

                        <Rectangle Name="ResolvableConflictBorder" 
                                   Width="{Binding ElementName=ResolvableConflictText, Path=ActualWidth}"
                                   Height="{Binding ElementName=ResolvableConflictText, Path=ActualHeight}"
                                   VerticalAlignment="Top"
                                   HorizontalAlignment="Left"/>
                        <TextBlock Name="ResolvableConflictText"
                                   Text="{Binding Path=ResolvableConflictText}" 
                                   Padding="4 2 4 4"
                                   VerticalAlignment="Top"
                                   HorizontalAlignment="Left"/>
                    </Grid>
                    <Grid Margin="0 4 0 0">
                        <Grid.Style>
                            <Style TargetType="Grid">
                                <Setter Property="Visibility" Value="Collapsed"/>

                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=HasUnresolvableConflicts}" Value="True">
                                        <Setter Property="Visibility" Value="Visible"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Grid.Style>

                        <Rectangle Name="UnresolvableConflictBorder"
                                   Width="{Binding ElementName=UnresolvableConflictText, Path=ActualWidth}"
                                   Height="{Binding ElementName=UnresolvableConflictText, Path=ActualHeight}"
                                   VerticalAlignment="Top"
                                   HorizontalAlignment="Left"/>
                        <TextBlock Name="UnresolvableConflictText"
                                   Text="{Binding Path=UnresolvableConflictText}" 
                                   Padding="4 2 4 4"
                                   VerticalAlignment="Top"
                                   HorizontalAlignment="Left"/>
                    </Grid>
                    <TextBlock Name="ErrorText" 
                               Text="{Binding Path=ErrorText}" 
                               Margin="0 4 0 0">
                        <TextBlock.Style>
                            <Style TargetType="TextBlock">
                                <Setter Property="Visibility" Value="Collapsed"/>

                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=HasError}" Value="True">
                                        <Setter Property="Visibility" Value="Visible"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBlock.Style>
                    </TextBlock>
                </StackPanel>

                <Button Name="ApplyButton" Click="Apply_Click" IsDefault="True" MinWidth="75" MinHeight="23" Padding="10,1,10,1" Margin="0,8,0,0" HorizontalAlignment="Right"
                    ToolTip="{Binding ElementName=dashboard, Path=ApplyToolTip}"
                    Style="{DynamicResource {x:Static rename:InlineRenameColors.ButtonStyleKey}}"
                    Content="{Binding ElementName=dashboard, Path=ApplyRename}"
                    AutomationProperties.Name="{Binding ElementName=dashboard, Path=ApplyRename}"/>
            </StackPanel>
        </Border>

        <Rectangle Name="DashboardAccentBar" Grid.Row="1" Height="4" Fill="{DynamicResource {x:Static rename:InlineRenameColors.AccentBarColorKey}}" />
    </Grid>
</rename:InlineRenameAdornment>
