Wednesday, February 2, 2011

Page Flipping in WPF-Book Control

Step-1-Add the dll -WPFMitsuControls.dll

Step-2-Add this Xaml Code

Namespace :
  xmlns:local="clr-namespace:GutenbunchBookView" Background="WhiteSmoke"
    xmlns:controls="clr-namespace:WPFMitsuControls;assembly=WPFMitsuControls"
Code: 

 <Grid>
        <Viewbox Name="V1">
            <Grid>
                <controls:Book x:Name="myBook" Width="800" Height="500" Margin="0">
                    <controls:Book.ItemTemplate>
                        <DataTemplate>
                            <Border BorderThickness="4" BorderBrush="Gray" Background="White">
                                <ContentControl Content="{Binding .}" />
                            </Border>
                        </DataTemplate>
                    </controls:Book.ItemTemplate>
                    <TextBox Text="Title"  Margin="5"></TextBox>
                </controls:Book>
            </Grid>
C#.net Code

We used the flowdocument Page viewer to this, u can use any controls ,
Where ( readpagecontents) carrys the text file inside.

                       FlowDocumentPageViewer rch1_singlepage = new FlowDocumentPageViewer();
                        Paragraph paragraph = new Paragraph();
                      paragraph.Inlines.Add((readpgcontents));
                     FlowDocument document = new FlowDocument(paragraph);
                       rch1_singlepage.Document = document;
                     myBook.Items.Add(rch1_singlepage);

Run the file and enjoy flipping /Book turn Effect in wpf



What is WPF?

Windows Presentation Foundation