Click here to Skip to main content
15,893,588 members
Articles / Desktop Programming / WPF

WPF Book Reader

Rate me:
Please Sign up or sign in to vote.
4.29/5 (16 votes)
10 May 2012GPL35 min read 111K   3.1K   120  
A WPF book reader for cbz/cbr files
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <LinearGradientBrush x:Key="windowBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Offset="0">
            <GradientStop.Color>
                <Color A="255" R="120" G="163" B="195"></Color>
            </GradientStop.Color>
        </GradientStop>
        <GradientStop Offset="0.5" >
            <GradientStop.Color>
                <Color A="255" R="214" G="222" B="235"></Color>
            </GradientStop.Color>
        </GradientStop>
        <GradientStop Offset="1">
            <GradientStop.Color>
                <Color A="255" R="120" G="163" B="195"></Color>
            </GradientStop.Color>
        </GradientStop>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="fillBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Offset="0" >
            <GradientStop.Color>
                <Color A="255" R="0" G="84" B="154"></Color>
            </GradientStop.Color>
        </GradientStop>
        <GradientStop Offset="1" >
            <GradientStop.Color>
                <Color A="255" R="2" G="24" B="84"></Color>
            </GradientStop.Color>
        </GradientStop>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="sliderBrush">
        <SolidColorBrush.Color>
            <Color A="255" R="217" G="227" B="239"/>
        </SolidColorBrush.Color>
    </SolidColorBrush>
    
    <!--minimize, maximize, close Buttons-->
    <Style x:Key="minimizeButton" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">       
                    <Grid>
                        <Rectangle Stretch="Fill" Fill="Transparent"></Rectangle>
                        <Rectangle Name="content" HorizontalAlignment="Center" Stroke="Black" Width="10" Height="2" VerticalAlignment="Bottom" Fill="White" StrokeThickness="0" />
                    </Grid>    
                    <ControlTemplate.Triggers>
                        <Trigger Property="Button.IsMouseOver" Value="True">
                            <Setter TargetName="content" Property="Fill" Value="{StaticResource fillBrush}"/>
                        </Trigger>
                        <Trigger Property="Button.IsPressed" Value="True">
                            <Setter Property="RenderTransform" TargetName="content">
                                <Setter.Value>
                                    <TranslateTransform X="1" Y="1"/>
                                </Setter.Value>
                            </Setter>
                            <!--<Setter TargetName="buttonRect" Property="Fill" Value="Transparent"/>-->
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="maximizeButton" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Rectangle Stretch="Fill" Fill="Transparent"></Rectangle>
                        <Rectangle HorizontalAlignment="Center" Name="content" Stroke="White" Width="9" Height="9" VerticalAlignment="Bottom" StrokeThickness="2" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Button.IsMouseOver" Value="True">
                            <Setter TargetName="content" Property="Stroke" Value="{StaticResource fillBrush}"/>
                        </Trigger>
                        <Trigger Property="Button.IsPressed" Value="True">
                            <Setter Property="RenderTransform" TargetName="content">
                                <Setter.Value>
                                    <TranslateTransform X="1" Y="1"/>
                                </Setter.Value>
                            </Setter>
                            <!--<Setter TargetName="buttonRect" Property="Fill" Value="Transparent"/>-->
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="closeButton" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Rectangle Stretch="Fill" Fill="Transparent"></Rectangle>
                        <Line Name="line1" X1="0" Y1="0" X2="8" Y2="8" Stroke="White" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Bottom"></Line>
                        <Line Name="line2" X1="8" Y1="0" X2="0" Y2="8" Stroke="White" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Bottom"></Line>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Button.IsMouseOver" Value="True">
                            <Setter TargetName="line1" Property="Stroke" Value="{StaticResource fillBrush}"/>
                            <Setter TargetName="line2" Property="Stroke" Value="{StaticResource fillBrush}"/>
                        </Trigger>
                        <Trigger Property="Button.IsPressed" Value="True">
                            <Setter Property="RenderTransform" TargetName="line1">
                                <Setter.Value>
                                    <TranslateTransform X="1" Y="1"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="RenderTransform" TargetName="line2">
                                <Setter.Value>
                                    <TranslateTransform X="1" Y="1"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</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)


Written By
Architect
France France
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/

Comments and Discussions