<!--=================================================================
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
==================================================================-->

<UserControl x:Class="Microsoft.PowerShell.Commands.ShowCommandInternal.AllModulesControl"
             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:this="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal"
             xmlns:default="clr-namespace:"
             xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal"
             FocusManager.FocusedElement="{Binding ElementName=CommandName}"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Border Background="Transparent" Cursor="Wait" Visibility="{Binding WaitMessageVisibility}">
            <TextBlock x:Name="WaitMessageText" Focusable="True" TextWrapping="Wrap" Text="{x:Static default:ShowCommandResources.PleaseWaitMessage}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
        </Border>
        <Grid Visibility="{Binding MainGridVisibility}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0" Margin="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>
                <Label Content="{x:Static default:ShowCommandResources.AllModulesControl_Label_Modules}" Grid.Row="0" Grid.Column="0" Margin="3"></Label>
                <ComboBox x:Name="ModulesCombo" Grid.Row="0" Grid.Column="1" Margin="3" ItemsSource="{Binding Modules}" AutomationProperties.Name="{x:Static default:ShowCommandResources.ModulesAutomationName}" DisplayMemberPath="DisplayName" SelectedItem="{Binding SelectedModule}" AutomationProperties.AutomationId="comboxModules">
                    <ComboBox.ItemContainerStyle>
                        <Style TargetType="ComboBoxItem">
                            <Setter Property="AutomationProperties.Name" Value="{Binding DisplayName}"/>
                        </Style>
                    </ComboBox.ItemContainerStyle>
                </ComboBox>
                <Button x:Name="RefreshButton" Padding="2,0,2,0" Grid.Row="0" Grid.Column="2" Click="RefreshButton_Click"  Visibility="{Binding RefreshVisibility}" Margin="3" Content="{x:Static default:ShowCommandResources.ShowModuleControl_RefreshButton}"
                        IsEnabled="{Binding Path='ExtraViewModel.CanRefresh'}"
                        ToolTip="{x:Static this:AllModulesViewModel.RefreshTooltip}"></Button>
                <Label Grid.Row="1" Grid.Column="0" Margin="3" Content="{x:Static default:ShowCommandResources.ShowModuleControl_Label_Name}"></Label>
                <TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="3" x:Name="CommandName" Text="{Binding Path=CommandNameFilter, UpdateSourceTrigger=PropertyChanged}" AutomationProperties.AutomationId="txtCommandName" AutomationProperties.Name="{x:Static default:ShowCommandResources.CommandNameAutomationName}"></TextBox>
            </Grid>
            <this:ShowModuleControl x:Name="ShowModuleControl" Grid.Row="1" DataContext="{Binding SelectedModule}" Margin="3"/>
        </Grid>
    </Grid>
</UserControl>
