PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/CBR/CBR/Views/File/RecentFileView.xaml

#
XAML | 119 lines | 113 code | 6 blank | 0 comment | 0 complexity | 145e0143adf0b6ec2362ab340df38fd9 MD5 | raw file
  1<UserControl x:Class="CBR.Views.RecentFileView"
  2             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  5             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  6             mc:Ignorable="d" 
  7			 xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
  8             xmlns:Converters="clr-namespace:CBR.Components.Converters"
  9             xmlns:Models="clr-namespace:CBR.Core.Models;assembly=CBR.Core"
 10             d:DesignHeight="300" d:DesignWidth="300" >
 11    <UserControl.Resources>
 12
 13        <DataTemplate x:Key="RecentBookTemplate" DataType="{x:Type Models:RecentFileInfo }">
 14            <Grid Margin="3">
 15                <Grid.ColumnDefinitions>
 16                    <ColumnDefinition Width="*"/>
 17                    <ColumnDefinition Width="Auto"/>
 18                </Grid.ColumnDefinitions>
 19                <Button Style="{StaticResource CBRButtonStyle}" Tag="{Binding}" HorizontalAlignment="Stretch" Click="BookButton_Click">
 20                    <StackPanel Orientation="Horizontal" Margin="5">
 21                        <Image Grid.Column="0" Margin="5" Source="/CBR;Component/Resources/Images/32x32/book.png"></Image>
 22                        <StackPanel Orientation="Vertical" Grid.Column="1" Margin="5">
 23                            <TextBlock Foreground="Black" Text="{Binding FileName}" FontSize="12" FontWeight="Bold" />
 24                            <TextBlock Foreground="Black" Text="{Binding FilePath}" FontSize="10" />
 25                        </StackPanel>
 26                    </StackPanel>
 27                </Button>
 28                <ToggleButton Grid.Column="2" IsChecked="{Binding IsPined}" Margin="5" Style="{StaticResource CBRPinButtonStyle}" />
 29            </Grid>
 30        </DataTemplate>
 31
 32        <DataTemplate x:Key="RecentCatalogTemplate" DataType="{x:Type Models:RecentFileInfo }">
 33            <Grid Margin="3">
 34                <Grid.ColumnDefinitions>
 35                    <ColumnDefinition Width="*"/>
 36                    <ColumnDefinition Width="Auto"/>
 37                </Grid.ColumnDefinitions>
 38                <Button Style="{StaticResource CBRButtonStyle}" Tag="{Binding}" HorizontalAlignment="Stretch" Click="CatalogButton_Click">
 39                    <StackPanel Orientation="Horizontal" Margin="5">
 40                        <Image Grid.Column="0" Margin="5" Source="/CBR;Component/Resources/Images/32x32/library_new.png"></Image>
 41                        <StackPanel Orientation="Vertical" Grid.Column="1" Margin="5">
 42                            <TextBlock Foreground="Black" Text="{Binding FileName}" FontSize="12" FontWeight="Bold" />
 43                            <TextBlock Foreground="Black" Text="{Binding FilePath}" FontSize="10" />
 44                        </StackPanel>
 45                    </StackPanel>
 46                </Button>
 47                <ToggleButton Grid.Column="2" IsChecked="{Binding IsPined}" Margin="5" Style="{StaticResource CBRPinButtonStyle}" />
 48            </Grid>
 49        </DataTemplate>
 50
 51    </UserControl.Resources>
 52    <Grid Margin="15" >
 53        <Grid.ColumnDefinitions>
 54            <ColumnDefinition Width="1*" />
 55            <ColumnDefinition Width="5" />
 56            <ColumnDefinition Width="1*" />
 57        </Grid.ColumnDefinitions>
 58        <Grid VerticalAlignment="Stretch">
 59            <Grid.RowDefinitions>
 60                <RowDefinition Height="Auto" />
 61                <RowDefinition Height="Auto" />
 62                <RowDefinition Height="*" />
 63            </Grid.RowDefinitions>
 64            <TextBlock Style="{StaticResource TitleLabel}" Margin="5" Grid.Row="1"
 65                       Text="{LocalizationExtension ResModul=CBR.Backstage, Key=RecentFileView.Files, DefaultValue=Recent files}" />
 66            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" Grid.Row="2" VerticalAlignment="Top" 
 67                  Visibility="{Binding ElementName=CatalogListBox, Path=Items.Count, Converter={x:Static Converters:IntToVisibilityConverter.Instance}, ConverterParameter=true, Mode=OneWay}" />
 68            <ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto" Grid.Row="3">
 69                <ItemsControl BorderThickness="0" Margin="10,0,10,10"
 70                    VirtualizingStackPanel.IsVirtualizing="True"
 71                    Name="BookListBox" 
 72                    ItemsSource="{Binding RecentBooks}"
 73                    ItemTemplate="{StaticResource RecentBookTemplate}">
 74                    <ItemsControl.GroupStyle>
 75                        <GroupStyle>
 76                            <GroupStyle.HeaderTemplate>
 77                                <DataTemplate>
 78                                <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
 79                                </DataTemplate>
 80                            </GroupStyle.HeaderTemplate>
 81                        </GroupStyle>
 82                    </ItemsControl.GroupStyle>
 83                </ItemsControl>
 84            </ScrollViewer>
 85        </Grid>
 86
 87        <Line Grid.Column="1"  X1="0" Y2="1" Style="{StaticResource VerticalSeparator}" />
 88
 89        <Grid Grid.Column="2" VerticalAlignment="Stretch">
 90            <Grid.RowDefinitions>
 91                <RowDefinition Height="Auto" />
 92                <RowDefinition Height="Auto" />
 93                <RowDefinition Height="*" />
 94            </Grid.RowDefinitions>
 95            <TextBlock Style="{StaticResource TitleLabel}" Margin="5" Grid.Row="1"
 96                       Text="{LocalizationExtension ResModul=CBR.Backstage, Key=RecentFileView.Libraries, DefaultValue=Recent libraries}" />
 97            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" Grid.Row="2" VerticalAlignment="Top" 
 98                  Visibility="{Binding ElementName=CatalogListBox, Path=Items.Count, Converter={x:Static Converters:IntToVisibilityConverter.Instance}, ConverterParameter=true, Mode=OneWay}" />
 99            <ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto" Grid.Row="3" Margin="0,0,0,100">
100                <ItemsControl BorderThickness="0" Margin="10,0,10,10"
101                VirtualizingStackPanel.IsVirtualizing="True"
102                Name="CatalogListBox" 
103                ItemsSource="{Binding RecentCatalogs}"
104                ItemTemplate="{StaticResource RecentCatalogTemplate}" >
105                <ItemsControl.GroupStyle>
106                    <GroupStyle>
107                        <GroupStyle.HeaderTemplate>
108                            <DataTemplate>
109                                <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
110                            </DataTemplate>
111                        </GroupStyle.HeaderTemplate>
112                    </GroupStyle>
113                </ItemsControl.GroupStyle>
114            </ItemsControl>
115            </ScrollViewer>
116        </Grid>
117
118    </Grid>
119</UserControl>