Source

main / Source / Excel / Excel.AddIn / Excel.AddIn / View / Usercontrols / SheetControl.xaml

Full commit
<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    x:Class="DataUp.Excel.Addin.SheetControl"
    x:Name="UserControl">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Resources/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <BooleanToVisibilityConverter x:Key="VisibilityConverter"></BooleanToVisibilityConverter>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Button Margin="10,5" Content="Remove Selected" Style="{DynamicResource GrayButton}" x:Name="btnRemoveSelected"
                Command="{Binding FixSelectedCommand}" Visibility="{Binding DataContext.IsPostAsXlsx, Converter={StaticResource VisibilityConverter}, RelativeSource={RelativeSource AncestorType=Window}}"/>

        <DataGrid x:Name="errorGridSheetControl" ItemsSource="{Binding Errors}" Style="{DynamicResource DataGridStyle}" 
                  RowBackground="#FFF9F9F9" AlternatingRowBackground="#FFFFFFFF" 
                  CanUserAddRows="False" CanUserDeleteRows="False" IsManipulationEnabled="False" IsReadOnly="True" 
                  VerticalGridLinesBrush="{DynamicResource GridVerticalLineBrush}" Grid.Row="1" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTemplateColumn Width="35" Visibility="{Binding DataContext.IsPostAsXlsx, Converter={StaticResource VisibilityConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox VerticalAlignment="Top" Margin="0,5,0,0"  IsChecked="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                      Command="{Binding DataContext.ErrorSelectedCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}" 
                                      IsEnabled="{Binding IsRemovable}" HorizontalAlignment="Center"
                                      Visibility="{Binding DataContext.IsPostAsXlsx, Converter={StaticResource VisibilityConverter}, RelativeSource={RelativeSource AncestorType=Window}}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Binding="{Binding Title}" Header="Potential problem" Width="160">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="Background" Value="Transparent"/>
                            <Setter Property="TextWrapping"  Value="Wrap"/>
                            <Setter Property="ToolTip" Value="{Binding Title}"/>
                            <Setter Property="Height" Value="Auto"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                            <Setter Property="Margin" Value="5,0"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Description}"  Header="Why this may be a problem" Width="200">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="Background" Value="Transparent"/>
                            <Setter Property="TextWrapping"  Value="Wrap"/>
                            <Setter Property="ToolTip" Value="{Binding Description}"/>
                            <Setter Property="Height" Value="Auto"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                            <Setter Property="Margin" Value="5,0"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Recommendation}" Header="Suggested remedy" Width="200">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="Background" Value="Transparent"/>
                            <Setter Property="TextWrapping"  Value="Wrap"/>
                            <Setter Property="ToolTip" Value="{Binding Recommendation}"/>
                            <Setter Property="Height" Value="Auto"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                            <Setter Property="Margin" Value="5,0"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding DisplayErrorAddress}" Header="Location(s)" Width="130">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="Background" Value="Transparent"/>
                            <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
                            <Setter Property="TextWrapping"  Value="Wrap"/>
                            <Setter Property="ToolTip" Value="{Binding DisplayErrorAddress}"/>
                            <Setter Property="Height" Value="Auto"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                            <Setter Property="Margin" Value="5,0"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>

    </Grid>
</UserControl>