In This Article

Book Class

A control that looks like a book.

[TemplatePart(Name = "PART_OverlayCanvas", Type = typeof(Canvas))]
public class Book : ItemsControl
Inheritance:
object Visual UIElement FrameworkElement Control ItemsControl object

Constructors

Book()

Initializes an instance of the Book class.

public Book()

Properties

AnimationState

Gets the current animation state of the control. This is a dependency property.

public BookAnimationState AnimationState { get; }

Property Value

BookAnimationState:

The current animation state of the control. The default value is BookAnimationState.None.

CornerRadius

Gets or sets a value that represents the degree to which the corners of a Book are rounded. This is a dependency property.

public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius:

The CornerRadius that describes the degree to which corners are rounded. The default value is 0,0,0,0.

HotspotExtent

Gets or sets the extent of the hot spot areas in the corners of the book. This is a dependency property.

public Unit HotspotExtent { get; set; }

Property Value

Unit:

The extent of the hot spot areas in the corners of the book. The default value is 10%.

IsFirstPageFront

Gets or sets a value indicating whether the first page displayed by the book is front facing. This is a dependency property.

public bool IsFirstPageFront { get; set; }

Property Value

bool:

true if the first page displayed by the book is front facing; otherwise, false. The default value is false.

Orientation

Gets or sets the orientation of the book. This is a dependency property.

public Orientation Orientation { get; set; }

Property Value

Orientation:

The orientation of the book. The default value is Orientation.Horizontal.

PageDepth

Gets or sets the number of pages measured and arranged on the back and front sides of the book. This is a dependency property.

public int PageDepth { get; set; }

Property Value

int:

The number of pages measured and arranged on the back and front sides of the book. The default value is 1.

PendingViewIndex

Gets or sets the index of the pending selected view. This is a dependency property.

public int? PendingViewIndex { get; set; }

Property Value

int?:

The index of the pending selected view. The default value is null.

SelectedBackIndex

Gets the index of the item presented on the back facing page in the selected view. This is a dependency property.

public int SelectedBackIndex { get; }

Property Value

int:

The index of the item presented on the back facing page in the selected view. The default value is -1.

SelectedBackItem

Gets the item presented on the back facing page in the selected view. This is a dependency property.

public object SelectedBackItem { get; }

Property Value

object:

The item presented on the front back page in the selected view. The default value is null.

SelectedFrontIndex

Gets the index of the item presented on the front facing page in the selected view. This is a dependency property.

public int SelectedFrontIndex { get; }

Property Value

int:

The index of the item presented on the front facing page in the selected view. The default value is -1.

SelectedFrontItem

Gets the item presented on the front facing page in the selected view. This is a dependency property.

public object SelectedFrontItem { get; }

Property Value

object:

The item presented on the front facing page in the selected view. The default value is null.

SelectedViewIndex

Gets or sets the index of the selected view. This is a dependency property.

public int SelectedViewIndex { get; set; }

Property Value

int:

The index of the selected view. The default value is 0.

ViewCount

Gets the view count.

public int ViewCount { get; }

Property Value

int:

The view count.

Methods

ClearContainerForItemOverride(DependencyObject, object)

protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The container element.

item object

The item.

GetContainerForItemOverride()

Creates or identifies the element used to display the specified item.

protected override DependencyObject GetContainerForItemOverride()

Returns

DependencyObject:

The element that is used to display the given item.

GoToFirstPage()

Selects the first view, if any.

public void GoToFirstPage()

GoToLastPage()

Selects the last view, if any.

public void GoToLastPage()

GoToNextPage()

Selects the next view, if any.

public void GoToNextPage()

GoToNextPage(int)

Selects the next view based on the specified number, if any.

public void GoToNextPage(int count)
Parameter Type Description
count int

GoToPage(int)

Selects the view that contains the specified page/item index.

public void GoToPage(int index)
Parameter Type Description
index int

The page/item index to select.

GoToPage(object)

Selects the view that contains the specified item.

public void GoToPage(object item)
Parameter Type Description
item object

The item to select.

GoToPreviousPage()

Selects the previous view, if any.

public void GoToPreviousPage()

GoToPreviousPage(int)

Selects the previous view based on the specified number, if any.

public void GoToPreviousPage(int count)
Parameter Type Description
count int

IsItemItsOwnContainerOverride(object)

Determines if the specified item is (or is eligible to be) its own container.

protected override bool IsItemItsOwnContainerOverride(object item)
Parameter Type Description
item object

The item to check.

Returns

bool:

true if the item is (or is eligible to be) its own container; otherwise, false.

ItemIndexToBookPageFace(int)

Converts an item index to a book page face, which indicates if the given item is on a back facing or front facing page.

public BookPageFace ItemIndexToBookPageFace(int itemIndex)
Parameter Type Description
itemIndex int

The index of the item to convert.

Returns

BookPageFace:

A BookPageFace that indicates if the given item is on a back facing or front facing page.

ItemIndexToBookPageFace(int, bool)

Converts an item index to a book page face, which indicates if the given item is on a back facing or front facing page.

public static BookPageFace ItemIndexToBookPageFace(int itemIndex, bool isFirstPageFront)
Parameter Type Description
itemIndex int

The index of the item to convert.

isFirstPageFront bool

if true then the first page of the book is front facing.

Returns

BookPageFace:

A BookPageFace that indicates if the given item is on a back facing or front facing page.

ItemIndexToViewIndex(int)

Converts an item index to a view index.

public int ItemIndexToViewIndex(int itemIndex)
Parameter Type Description
itemIndex int

The index of the item to convert.

Returns

int:

The view index that contains the specified item index.

ItemIndexToViewIndex(int, bool)

Converts an item index to a view index.

public int ItemIndexToViewIndex(int itemIndex, bool isFirstPageFront)
Parameter Type Description
itemIndex int

The index of the item to convert.

isFirstPageFront bool

if true then the first page of the book is front facing.

Returns

int:

The view index that contains the specified item index.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate.

public override void OnApplyTemplate()

OnCreateAutomationPeer()

Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific AutomationPeer implementation.

OnItemsChanged(NotifyCollectionChangedEventArgs)

Invoked whenever the Items collection changes.

protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameter Type Description
e NotifyCollectionChangedEventArgs

The NotifyCollectionChangedEventArgs object that contains the event data.

OnMouseLeave(MouseEventArgs)

Called before the MouseLeave event occurs.

protected override void OnMouseLeave(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

The data for the event.

OnMouseLeftButtonDown(MouseButtonEventArgs)

Called before the MouseLeftButtonDown event occurs.

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameter Type Description
e MouseButtonEventArgs

The data for the event.

OnMouseLeftButtonUp(MouseButtonEventArgs)

Called before the MouseLeftButtonUp event occurs.

protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameter Type Description
e MouseButtonEventArgs

The data for the event.

OnMouseMove(MouseEventArgs)

Called before the MouseMove event occurs.

protected override void OnMouseMove(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

The data for the event.

OnPageCurlActivated(BookPageRoutedEventArgs)

Invoked when an unhandled PageCurlActivated attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected virtual void OnPageCurlActivated(BookPageRoutedEventArgs e)
Parameter Type Description
e BookPageRoutedEventArgs

A BookPageRoutedEventArgs that contains the event data.

OnPageCurlActivating(CancelBookPageRoutedEventArgs)

Invoked when an unhandled PageCurlActivating attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected virtual void OnPageCurlActivating(CancelBookPageRoutedEventArgs e)
Parameter Type Description
e CancelBookPageRoutedEventArgs

A CancelBookPageRoutedEventArgs that contains the event data.

OnPageCurlDeactivated(BookPageRoutedEventArgs)

Invoked when an unhandled PageCurlDeactivated attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected virtual void OnPageCurlDeactivated(BookPageRoutedEventArgs e)
Parameter Type Description
e BookPageRoutedEventArgs

A BookPageRoutedEventArgs that contains the event data.

OnPageFlipped(BookPageRoutedEventArgs)

Invoked when an unhandled PageFlipped attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected virtual void OnPageFlipped(BookPageRoutedEventArgs e)
Parameter Type Description
e BookPageRoutedEventArgs

A BookPageRoutedEventArgs that contains the event data.

OnPageFlipping(CancelBookPageRoutedEventArgs)

Invoked when an unhandled PageFlipping attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected virtual void OnPageFlipping(CancelBookPageRoutedEventArgs e)
Parameter Type Description
e CancelBookPageRoutedEventArgs

A CancelBookPageRoutedEventArgs that contains the event data.

OnSelectedViewChanged(PropertyChangedRoutedEventArgs<int>)

Invoked when an unhandled SelectedViewChanged attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected virtual void OnSelectedViewChanged(PropertyChangedRoutedEventArgs<int> e)
Parameter Type Description
e PropertyChangedRoutedEventArgs<int>

The PropertyChangedRoutedEventArgs<T> instance containing the event data.

OnSelectedViewChanging(PropertyChangingRoutedEventArgs<int>)

Invoked when an unhandled SelectedViewChanging attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

protected virtual void OnSelectedViewChanging(PropertyChangingRoutedEventArgs<int> e)
Parameter Type Description
e PropertyChangingRoutedEventArgs<int>

A PropertyChangingRoutedEventArgs<int> that contains the event data.

PrepareContainerForItemOverride(DependencyObject, object)

Prepares the specified element to display the specified item.

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter Type Description
element DependencyObject

The element used to display the specified item.

item object

The item to display.

ResetCommandBindings()

Resets the CommandBindings property to its default value.

public virtual void ResetCommandBindings()

ResetInputBindings()

Resets the InputBindings property to its default value.

public virtual void ResetInputBindings()

ViewIndexToItemIndexes(int)

Converts a view index to the associated item indexes.

public int[] ViewIndexToItemIndexes(int viewIndex)
Parameter Type Description
viewIndex int

The index of the view to convert.

Returns

int[]:

The item indexes that are contained in the specified view index.

Remarks

The method always returns an int array with a length of 2, where the first integer represents the item presented on the back of a page and the second integer represents the item presented on the front of a page. Both values can be set to -1, which indicates that there is no item present on that side of the book.

ViewIndexToItemIndexes(int, int, bool)

Converts a view index to the associated item indexes.

public static int[] ViewIndexToItemIndexes(int viewIndex, int count, bool isFirstPageFront)
Parameter Type Description
viewIndex int

The index of the view to convert.

count int

The number of pages.

isFirstPageFront bool

if true then the first page of the book is front facing.

Returns

int[]:

The item indexes that are contained in the specified view index.

Remarks

The method always returns an int array with a length of 2, where the first integer represents the item presented on the back of a page and the second integer represents the item presented on the front of a page. Both values can be set to -1, which indicates that there is no item present on that side of the book.

Events

PageCurlActivated

Occurs when a page has curled.

public event EventHandler<BookPageRoutedEventArgs> PageCurlActivated

Event Type

EventHandler<BookPageRoutedEventArgs>

PageCurlActivating

Occurs when a page is about to curl.

public event EventHandler<CancelBookPageRoutedEventArgs> PageCurlActivating

Event Type

EventHandler<CancelBookPageRoutedEventArgs>

PageCurlDeactivated

Occurs when a page is no longer curled.

public event EventHandler<BookPageRoutedEventArgs> PageCurlDeactivated

Event Type

EventHandler<BookPageRoutedEventArgs>

PageFlipped

Occurs when a page has flipped.

public event EventHandler<BookPageRoutedEventArgs> PageFlipped

Event Type

EventHandler<BookPageRoutedEventArgs>

PageFlipping

Occurs when a page is about to flip.

public event EventHandler<CancelBookPageRoutedEventArgs> PageFlipping

Event Type

EventHandler<CancelBookPageRoutedEventArgs>

SelectedViewChanged

Occurs when the selected view has changed.

public event EventHandler<PropertyChangedRoutedEventArgs<int>> SelectedViewChanged

Event Type

EventHandler<PropertyChangedRoutedEventArgs<int>>

SelectedViewChanging

Occurs when the selected view is about to change.

public event EventHandler<PropertyChangingRoutedEventArgs<int>> SelectedViewChanging

Event Type

EventHandler<PropertyChangingRoutedEventArgs<int>>

Fields

AnimationStateProperty

Identifies the read-only AnimationState dependency property. This field is read-only.

public static readonly DependencyProperty AnimationStateProperty

CornerRadiusProperty

Identifies the CornerRadius dependency property. This field is read-only.

public static readonly DependencyProperty CornerRadiusProperty

HotspotExtentProperty

Identifies the HotspotExtent dependency property. This field is read-only.

public static readonly DependencyProperty HotspotExtentProperty

IsFirstPageFrontProperty

Identifies the IsFirstPageFront dependency property. This field is read-only.

public static readonly DependencyProperty IsFirstPageFrontProperty

OrientationProperty

Identifies the Orientation dependency property. This field is read-only.

public static readonly DependencyProperty OrientationProperty

PageCurlActivatedEvent

Identifies the PageCurlActivated routed event. This field is read-only.

public static readonly RoutedEvent PageCurlActivatedEvent

PageCurlActivatingEvent

Identifies the PageCurlActivating routed event. This field is read-only.

public static readonly RoutedEvent PageCurlActivatingEvent

PageCurlDeactivatedEvent

Identifies the PageCurlDeactivated routed event. This field is read-only.

public static readonly RoutedEvent PageCurlDeactivatedEvent

PageDepthProperty

Identifies the PageDepth dependency property. This field is read-only.

public static readonly DependencyProperty PageDepthProperty

PageFlippedEvent

Identifies the PageFlipped routed event. This field is read-only.

public static readonly RoutedEvent PageFlippedEvent

PageFlippingEvent

Identifies the PageFlipping routed event. This field is read-only.

public static readonly RoutedEvent PageFlippingEvent

PendingViewIndexProperty

Identifies the PendingViewIndex dependency property. This field is read-only.

public static readonly DependencyProperty PendingViewIndexProperty

SelectedBackIndexProperty

Identifies the read-only SelectedBackIndex dependency property. This field is read-only.

public static readonly DependencyProperty SelectedBackIndexProperty

SelectedBackItemProperty

Identifies the read-only SelectedBackItem dependency property. This field is read-only.

public static readonly DependencyProperty SelectedBackItemProperty

SelectedFrontIndexProperty

Identifies the read-only SelectedFrontIndex dependency property. This field is read-only.

public static readonly DependencyProperty SelectedFrontIndexProperty

SelectedFrontItemProperty

Identifies the read-only SelectedFrontItem dependency property. This field is read-only.

public static readonly DependencyProperty SelectedFrontItemProperty

SelectedViewChangedEvent

Identifies the SelectedViewChanged routed event. This field is read-only.

public static readonly RoutedEvent SelectedViewChangedEvent

SelectedViewChangingEvent

Identifies the SelectedViewChanging routed event. This field is read-only.

public static readonly RoutedEvent SelectedViewChangingEvent

SelectedViewIndexProperty

Identifies the SelectedViewIndex dependency property. This field is read-only.

public static readonly DependencyProperty SelectedViewIndexProperty