<UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Maintain.ViewModels.MaintainConfirmView"
             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:local="clr-namespace:MECF.Framework.UI.Client.CenterViews.Maintain"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:micro="clr-namespace:Caliburn.Micro"
             mc:Ignorable="d">
    <UserControl.Resources>
        <local:StringNullToUIVisibilityConverter x:Key="stringNullToUIVisibilityConverter"/>
    </UserControl.Resources>
    <Border Height="480" Width="1000" BorderBrush="{DynamicResource Color_BD_Logoff}" BorderThickness="5" Background="{DynamicResource Color_BG_Logoff}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="5*"/>
                <RowDefinition Height="6*"/>
                <RowDefinition Height="3*"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0" DataContext="{Binding MaInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="3*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="1" Text="{Binding DisplayName}" FontSize="24" HorizontalAlignment="Right"/>
            </Grid>
            <Grid Grid.Row="1" DataContext="{Binding ItemInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="8*"/>
                    <ColumnDefinition Width="8*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="8*"/>
                    <ColumnDefinition Width="8*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="1" Text="{Binding Config.ParentName}" FontSize="20" HorizontalAlignment="Right" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="2" Text="-" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="3" Text="{Binding Config.Name}" FontSize="20" HorizontalAlignment="Left" VerticalAlignment="Center"/>
            </Grid>
            <Grid Grid.Row="2" DataContext="{Binding ItemInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="40"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Latest Maintain Date:" FontSize="20" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="2" Text="{Binding MaintainedDate}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center"/>
            </Grid>
            <Grid Grid.Row="3" DataContext="{Binding ItemInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="20*"/>
                    <ColumnDefinition Width="2*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Description:" FontSize="20" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                <Border Grid.Column="2" CornerRadius="5" BorderThickness="2" BorderBrush="Black" Width="{Binding RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=1},Path=ColumnDefinitions[2].ActualWidth}">
                    <TextBlock Text="{Binding Config.Description}" Background="White" Foreground="Black" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </Border>
                <Image Grid.Column="3" Width="40" Height="40" VerticalAlignment="Bottom"
                       Source="/MECF.Framework.UI.Client;component/Resources/Images/file.png" 
                       Stretch="Uniform"
                       Cursor="Hand"
                       Visibility="{Binding Config.FilePath,Converter={StaticResource stringNullToUIVisibilityConverter}}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="MouseLeftButtonUp">
                            <micro:ActionMessage MethodName="FileOpen">
                                <micro:Parameter Value="{Binding Config.FilePath}" />
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Image>
            </Grid>
            <Grid Grid.Row="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="20*"/>
                    <ColumnDefinition Width="2*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Detail Record:" FontSize="20" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                <TextBox Grid.Column="2" Text="{Binding Record,Mode=TwoWay}" 
                         Width="{Binding RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=1},Path=ColumnDefinitions[2].ActualWidth}" 
                         Background="White" Foreground="Black" FontSize="16" HorizontalAlignment="Right" 
                         TextWrapping="Wrap"
                         VerticalScrollBarVisibility="Auto"
                         AcceptsReturn="True"/>
            </Grid>
            <Grid Grid.Row="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Button Content="Cancel" Grid.Column="0" Width="120" Height="50">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="NGExit">
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button Content="OK" Grid.Column="1" Width="120" Height="50">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="OKExit">
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
            </Grid>
        </Grid>
    </Border>
</UserControl>
