Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

WPF Book Reader

, 10 May 2012 GPL3
A WPF book reader for cbz/cbr files
BookReaderv1.zip
BookReader.exe.manifest
ICSharpCode.SharpZipLib.dll
SevenZipSharp.dll
WPFToolkit.dll
Dependencies
7z.dll
BookReader.application
BookReader.exe
BookReaderv1_source.zip
BookReader
ClassDiagram.cd
Dependencies
7-zip.dll
7z.dll
ICSharpCode.SharpZipLib.dll
SevenZipSharp.dll
WPFToolkit.dll
Properties
app.manifest
Settings.settings
Reader
Catalog
Common
Images
RAR
ZIP
Resources
TheRedPushPin.png
XAML
BookReaderv2.zip
BookReader.application
BookReader.exe
BookReader.exe.manifest
7z.dll
SevenZipSharp.dll
WPFToolkit.dll
BookReaderv2_8.zip
Release
BookReader.application
BookReader.exe
BookReader.exe.manifest
Dependencies
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
BookReaderv2_8_source.zip
BookReader.csproj.user
BookReader.csproj.vspscc
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
app.manifest
Settings.settings
acroread.png
document.png
ecran.png
exit.png
FitHeight.png
FitWidth.png
info.png
open_folder.png
refresh.png
Search.png
Theme
TheRedPushPin.png
tools.png
BookReaderv2_source.zip
BookReader.csproj.user
ClassDiagram.cd
7-zip.dll
7z.dll
ICSharpCode.SharpZipLib.dll
SevenZipSharp.dll
WPFToolkit.dll
app.manifest
Settings.settings
TheRedPushPin.png
BookReaderv3_0.zip
BookReader.application
BookReader.exe
BookReader.exe.manifest
BookReader.vshost.exe
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
BookReaderv3_0_source.zip
BookReader.csproj.user
BookReader.csproj.vspscc
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
app.manifest
Settings.settings
acroread.png
book.ico
document.png
ecran.png
exit.png
FitHeight.png
FitWidth.png
info.png
open_folder.png
refresh.png
Search.png
TheRedPushPin.png
tools.png
<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"/>
    
    <!-- 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="6">
            <!-- Image Template -->
            <Border BorderBrush="Black" BorderThickness="4" CornerRadius="5" Margin="6">
                <Grid Margin="0,0,0,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.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Guillaume Waser
Architect A.C.S.
France France
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 10 May 2012
Article Copyright 2009 by Guillaume Waser
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid