<UserControl x:Class="FLY.ControlLibrary.GraphScan"
             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:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
             xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
             xmlns:local="clr-namespace:FLY.ControlLibrary"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" >
    <UserControl.Resources>
        <local:IsValidConverter x:Key="isvalidconv"/>
        <local:LeftRightConverter x:Key="lrconv"/>
        <ControlTemplate x:Key="picture_button" TargetType="Button">
            <Border Name="border" BorderThickness="1" CornerRadius="5">
                <ContentPresenter Content="{TemplateBinding Content}"/>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter TargetName="border" Property="Background" Value="LightGray"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </UserControl.Resources>
    <Grid Name="grid" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="258*" />
        </Grid.RowDefinitions>
        <Grid Name="grid_title">
            <Grid.RowDefinitions>
                <RowDefinition Height="18" />
                <RowDefinition Height="22" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Rectangle Name="rectangle" Fill="{Binding IsValid,Converter={StaticResource ResourceKey=isvalidconv}}" Grid.ColumnSpan="4"/>
            
            <Button x:Name="m_LogoImageButtonUC" Height="40" Width="40"  Click="Button_Click" Template="{StaticResource ResourceKey=picture_button}" Grid.RowSpan="2">
                <Grid >
                    <Image Source="/FLY.ControlLibrary;component/Images/info.png" />
                </Grid>
            </Button>
            <Grid Grid.RowSpan="2" Grid.Column="1" Margin="2" Name="grid_left">
                <TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="左">
                    <TextBlock.Visibility>
                        <MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="LIsL">
                            <Binding Path="LeftRightIsVisable"/>
                            <Binding Path="LeftRightIsReversed"/>
                        </MultiBinding>
                    </TextBlock.Visibility>
                </TextBlock>
                <TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="右">
                    <TextBlock.Visibility>
                        <MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="LIsR">
                            <Binding Path="LeftRightIsVisable"/>
                            <Binding Path="LeftRightIsReversed"/>
                        </MultiBinding>
                    </TextBlock.Visibility>
                </TextBlock>
            </Grid>


            <TextBlock HorizontalAlignment="Center" FontSize="18" VerticalAlignment="Bottom" Grid.Row="1" Grid.Column="2">
                <Run Name="run_title" Text="{Binding Title}" FontWeight="SemiBold" />
                <Run Name="run_title2" Text="{Binding Title2}" Foreground="#FF585858" />
            </TextBlock>

            <Grid Grid.RowSpan="2" Grid.Column="3" Margin="2" Name="grid_right">
                <TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="左">
                    <TextBlock.Visibility>
                        <MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="RIsL">
                            <Binding Path="LeftRightIsVisable"/>
                            <Binding Path="LeftRightIsReversed"/>
                        </MultiBinding>
                    </TextBlock.Visibility>
                </TextBlock>
                <TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="右">
                    <TextBlock.Visibility>
                        <MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="RIsR">
                            <Binding Path="LeftRightIsVisable"/>
                            <Binding Path="LeftRightIsReversed"/>
                        </MultiBinding>
                    </TextBlock.Visibility>
                </TextBlock>
            </Grid>
        </Grid>
        <WindowsFormsHost Grid.Row="1">
            <Chr:Chart x:Name="chart1" />
        </WindowsFormsHost>
    </Grid>
    
</UserControl>
