Source

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

<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"
    xmlns:local="clr-namespace:DataUp.Excel.Addin"
    x:Class="DataUp.Excel.Addin.ErrorXSLX"
    x:Name="UserControl">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Resources/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <BooleanToVisibilityConverter x:Key="VisibilityConverter"></BooleanToVisibilityConverter>

            <DataTemplate x:Key="SummayTabItemCountHeader">
                <TextBlock />
            </DataTemplate>

            <DataTemplate x:Key="SheetTabItemCountHeader">
                <TextBlock FontSize="11"><Run Text="("/><Run Text=" "/><Run Text="{Binding TotalErrorCount}"/><Run Text=" "/><Run Text=")"/></TextBlock>
            </DataTemplate>

            <local:ErrorPaneDataTemplateSelector x:Key="HeaderCountTemplateSelector" 
                                                 SheetTemplate="{StaticResource SheetTabItemCountHeader}"
                                                 SummaryTemplate="{StaticResource SummayTabItemCountHeader}" />

            <DataTemplate x:Key="ErrorTabItemTemplate">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding SheetName}" TextTrimming="CharacterEllipsis"/>
                    <ContentControl Grid.Column="1" Content="{Binding}" ContentTemplateSelector="{StaticResource HeaderCountTemplateSelector}" />
                </Grid>
            </DataTemplate>

            <DataTemplate x:Key="ErrorSummaryDataTemplate">
                <Grid>
                    <local:WorkspaeControl DataContext="{Binding}" />
                </Grid>
            </DataTemplate>

            <DataTemplate x:Key="ErrorSheetDataTemplate">
                <Grid>
                    <local:SheetControl DataContext="{Binding}" />
                </Grid>
            </DataTemplate>

            <ItemsPanelTemplate x:Key="HorizontalPanelTemplate">
                <VirtualizingStackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>

            <local:ErrorPaneDataTemplateSelector x:Key="ErrorTemplateSelector" 
                                                 SheetTemplate="{StaticResource ErrorSheetDataTemplate}"
                                                 SummaryTemplate="{StaticResource ErrorSummaryDataTemplate}" />

        </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Text="Your document is checked for the best practice violations, csv compatibility issues, and presence of embedded objects, graphics, charts, etc. All such issues will be highlighted below:" 
                   Style="{DynamicResource DescriptionTextStyle}" Margin="0,10" Foreground="{DynamicResource LabelForeground}"/>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <ListBox  Grid.Row="0" Style="{DynamicResource TabListBoxStyle}"  x:Name="SheetsListBox"
                     ItemsPanel="{DynamicResource HorizontalPanelTemplate}" ScrollViewer.VerticalScrollBarVisibility="Disabled" 
                     ItemContainerStyle="{DynamicResource ErrorTabListboxItemStyle}" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                     ItemsSource="{Binding Path=SheetDetails}" IsSynchronizedWithCurrentItem="True"
                     SelectedItem="{Binding Path=SelectedSheet, Mode=TwoWay}">
            </ListBox>

            <ContentControl Grid.Row="1" Content="{Binding Path=SelectedItem, ElementName=SheetsListBox}" ContentTemplateSelector="{StaticResource ErrorTemplateSelector}" />

        </Grid>
    </Grid>
</UserControl>