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

C.B.R.

Rate me:
Please Sign up or sign in to vote.
4.96/5 (52 votes)
22 Oct 2012GPL329 min read 125.3K   1.8K   132  
Comic and electronic publication reader with library management, extended file conversion, and devices support.
<UserControl x:Class="CBR.Views.InfoView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Converters="clr-namespace:CBR.Components.Converters"
        xmlns:Controls="clr-namespace:CBR.Components.Controls"
        xmlns:Models="clr-namespace:CBR.Core.Models;assembly=CBR.Core" >
    
    <UserControl.Resources>
        
        <DataTemplate x:Key="PropertyTemplate">
            <UniformGrid Margin="4" Columns="2">
                <Label Content="{Binding Key}" />
                <TextBox Text="{Binding Value}" />
            </UniformGrid>
        </DataTemplate>

    </UserControl.Resources>

    <Grid Margin="15" Visibility="{Binding IsEmpty, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}, ConverterParameter=false}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="139*" />
            <ColumnDefinition Width="14*" />
            <ColumnDefinition Width="125*" />
        </Grid.ColumnDefinitions>

        <StackPanel  Grid.Row="0" Grid.ColumnSpan="3">
            <TextBlock Style="{StaticResource TitleLabel}" Margin="5" Text="{Binding Path=FileName, StringFormat=Information about {0:S}}" />
            <Label Margin="5" Content="{Binding Path=Folder}"/>
        </StackPanel>
        <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" Grid.Row="1" Grid.ColumnSpan="3" VerticalAlignment="Top" />

        <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Vertical" Margin="10">
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Cover</TextBlock>
            <Image Source="{Binding Cover}" Width="70"></Image>

            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
            
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Properties</TextBlock>
            <StackPanel>
                <UniformGrid Columns="2">

                    <Label>Type</Label>
                    <Image Width="32" Height="32" VerticalAlignment="Center" HorizontalAlignment="Left"
                            Source="{Binding Path=Type, Converter={x:Static Converters:TypeToImageConverter.Instance}}" />
                    
                    <Label>Size</Label>
                    <Label Content="{Binding Path=Size}"/>

                    <Label>Page count</Label>
                    <Label Content="{Binding PageCount}"/>

                    <Label>Rating</Label>
                    <Controls:RatingControl HorizontalAlignment="Stretch" Height="15" RatingValue="{Binding Rating}" />

                    <Label>Has been read</Label>
                    <Label Content="{Binding IsRead}"/>

                    <Label>Is secured</Label>
                    <Label Content="{Binding IsSecured}"/>

                </UniformGrid>
                
            </StackPanel>
            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
        </StackPanel>

        <Line Grid.Row="1" Grid.RowSpan="2" Grid.Column="1"  X1="0" Y2="1" Style="{StaticResource VerticalSeparator}" />

        <StackPanel Grid.Column="2" Grid.Row="1" Orientation="Vertical" Margin="10">
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Dynamic properties</TextBlock>
            <Label Margin="5" HorizontalAlignment="Stretch">Comming from the option panel, you can define these values here</Label>
            <ListBox 
                ItemsSource="{Binding KeyValueList}"
                ItemTemplate="{StaticResource PropertyTemplate}"
                >
                    
            </ListBox>
            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
        </StackPanel>
        
    </Grid>
</UserControl>

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