<!--
    DrFx - FxCop Report Translator and Visualizer.
    Copyright (C) 2010 Sasa Yuan
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
    
<UserControl x:Class="Sasa.QualityTools.DrFx.Explorer.FxCopIssueDetailWidget"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:report="clr-namespace:Sasa.QualityTools.DrFx.Explorer.Report"
             x:Name="root">
    <ScrollViewer VerticalScrollBarVisibility="Auto">
        <Grid DataContext="{Binding FxCopIssueRelationship, ElementName=root}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <GroupBox Grid.Row="0" Header="違反している箇所" Margin="5">
                <StackPanel>
                    <TextBlock Text="{Binding Issue.FilePath}" Margin="5" />
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
                        <ItemsControl ItemsSource="{Binding Lines, ElementName=root}" Margin="20,0,20,0">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate DataType="{x:Type report:SourceCodeLine}">
                                    <StackPanel Orientation="Horizontal">
                                        <StackPanel.Style>
                                            <Style TargetType="StackPanel">
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding IsViolationLine}" Value="True">
                                                        <Setter Property="Background" Value="LightPink"/>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </StackPanel.Style>
                                        <TextBlock Text="{Binding LineNumber}" Width="30" TextAlignment="Right"/>
                                        <TextBlock Margin="2,0,3,0" >:</TextBlock>
                                        <TextBlock Text="{Binding Text}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </StackPanel>
            </GroupBox>
            <GroupBox Grid.Row="1" Header="違反したルール" Margin="5">
                <StackPanel Margin="5">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Rule.CheckId}" FontSize="12" Margin="0,5,5,5"/>
                        <TextBlock Text="{Binding Rule.Category, StringFormat=(\{0\})}" FontSize="12" Margin="0,5,5,5"/>
                    </StackPanel>
                    <TextBlock Text="{Binding Rule.Name}" FontSize="14" FontWeight="Bold" TextWrapping="Wrap" Margin="5"/>
                    <TextBlock Text="{Binding Rule.Description}" TextWrapping="Wrap" Margin="25,10,25,10"/>
                </StackPanel>
            </GroupBox>
        </Grid>
    </ScrollViewer>
</UserControl>
