|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BookReader" >
<local:BookmarkToVisibilityConverter x:Key="BookmarkToVisibilityConverter"/>
<local:ReadToColorConverter x:Key="ReadToColorConverter"/>
<!-- TOOLTIP style and associated datatemplate -->
<Style x:Key="TransparentToolTipStyle" TargetType="{x:Type ToolTip}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToolTip}">
<Border >
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="MetadataTemplate" DataType="{x:Type local:BaseBook}">
<Grid >
<Grid.Resources>
<Style TargetType="{x:Type TextBlock}" x:Key="TextBlockBase">
<Setter Property="Foreground" Value="Silver"/>
</Style>
<Style TargetType="{x:Type TextBlock}" x:Key="{x:Type TextBlock}" BasedOn="{StaticResource TextBlockBase}">
</Style>
<Style TargetType="{x:Type TextBlock}" x:Key="Data" BasedOn="{StaticResource TextBlockBase}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
</Grid.Resources>
<Border Padding="2,2,2,2" CornerRadius="8" BorderBrush="#40000000" BorderThickness="2">
<Border CornerRadius="6" ClipToBounds="True" Padding="6,6,6,6">
<Border.Background>
<LinearGradientBrush EndPoint="0.75,0.319" StartPoint="0.213,0.672">
<GradientStop Color="#99000000"/>
<GradientStop Color="#EA000000" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=FileName}" FontSize="14" DockPanel.Dock="Left" Style="{StaticResource Data}" />
<TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Path=FilePath}" />
<Image Grid.Column="0" Grid.RowSpan="3" Source="{Binding Path=Cover}" Width="70"/>
<Grid Grid.Column="1" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="12" />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Text="File size:" />
<TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding Path=Size}" Style="{StaticResource Data}"/>
<TextBlock Grid.Column="0" Grid.Row="1" Text="Page count:" />
<TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding Path=NbPages}" Style="{StaticResource Data}"/>
</Grid>
</Grid>
</Border>
</Border>
</Grid>
</DataTemplate>
<!-- END TOOLTIP -->
<!-- CATALOG style and associated datatemplate -->
<Style x:Key="CatalogCoverStyle" TargetType="{x:Type ListBox}">
<!-- Swap out the default items panel with a WrapPanel so that
the images will be arranged with a different layout. -->
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<!-- Set this attached property to 'Disabled' so that the
ScrollViewer in the ListBox will never show a horizontal
scrollbar, and the WrapPanel it contains will be constrained
to the width of the ScrollViewer's viewable surface. -->
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
</Style>
<!-- Style for an individual generic item -->
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}" >
<Border SnapsToDevicePixels="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Background="{TemplateBinding Background}">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#445B6249"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate DataType="{x:Type local:BaseBook }">
<Grid Margin="5">
<!-- Image Template -->
<Border BorderThickness="6" CornerRadius="5" Margin="0"
BorderBrush="{Binding Path=IsRead, Converter={StaticResource ReadToColorConverter}}">
<Grid Margin="0">
<Image Source="{Binding Path=Cover}" Width="70">
<Image.ToolTip>
<ToolTip Style="{DynamicResource TransparentToolTipStyle}">
<ContentControl Content="{Binding}" ContentTemplate="{StaticResource MetadataTemplate}"/>
</ToolTip>
</Image.ToolTip>
</Image>
<Image Source="TheRedPushPin.png" Height="30" HorizontalAlignment="Right" VerticalAlignment="Top"
Visibility="{Binding Path=Bookmark, Converter={StaticResource BookmarkToVisibilityConverter}}"></Image>
</Grid>
</Border>
</Grid>
</DataTemplate>
</ResourceDictionary>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
WPF and MVVM fan, I practice C # in all its forms from the beginning of the NET Framework without mentioning C ++ / MFC and other software packages such as databases, ASP, WCF, Web & Windows services, Application, and now Core and UWP.
In my wasted hours, I am guilty of having fathered C.B.R. and its cousins C.B.R. for WinRT and UWP on the Windows store.
But apart from that, I am a great handyman ... the house, a rocket stove to heat the jacuzzi and the last one: a wood oven for pizza, bread, and everything that goes inside
https://guillaumewaser.wordpress.com/
https://fouretcompagnie.wordpress.com/