Book Class
A control that looks like a book.
[TemplatePart(Name = "PART_OverlayCanvas", Type = typeof(Canvas))]
public class Book : ItemsControl, IOrientedElement
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl object
- Implements:
- IOrientedElement
Constructors
Book()
Initializes an instance of the Book class.
public Book()
Properties
AnimationState
The current animation state of the control.
public BookAnimationState AnimationState { get; }
Property Value
- BookAnimationState:
The default value is None.
CornerRadius
A value that represents the degree to which the corners of a Book are rounded.
public CornerRadius CornerRadius { get; set; }
Property Value
- CornerRadius:
The default value is
0,0,0,0.
HotspotExtent
The extent of the hot spot areas in the corners of the book.
IsFirstPageFront
Indicates whether the first page displayed by the book is front facing.
public bool IsFirstPageFront { get; set; }
Property Value
- bool:
trueif the first page displayed by the book is front facing; otherwise,false. The default value isfalse.
Orientation
The orientation of the book.
public Orientation Orientation { get; set; }
Property Value
- Orientation:
The default value is Horizontal.
PageDepth
The number of pages measured and arranged on the back and front sides of the book.
PendingViewIndex
The index of the pending selected view.
SelectedBackIndex
The index of the item presented on the back facing page in the selected view.
SelectedBackItem
The item presented on the back facing page in the selected view.
SelectedFrontIndex
The index of the item presented on the front facing page in the selected view.
SelectedFrontItem
The item presented on the front facing page in the selected view.
SelectedViewIndex
The index of the selected view.
ViewCount
The view count.
Methods
ClearContainerForItemOverride(DependencyObject, object)
When overridden in a derived class, undoes the effects of the PrepareContainerForItemOverride(DependencyObject, object) method.
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 that is used to display the given 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:
trueif 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
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 |
Returns
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
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 |
Returns
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes 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 when the Items property changes.
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | NotifyCollectionChangedEventArgs | Information about the change. |
OnMouseLeave(MouseEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.MouseLeave attached event is raised on this element. Implement this method to add class handling for this event.
protected override void OnMouseLeave(MouseEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseEventArgs | The MouseEventArgs that contains the event data. |
OnMouseLeftButtonDown(MouseButtonEventArgs)
Invoked when an unhandled MouseLeftButtonDown routed event is raised on this element. Implement this method to add class handling for this event.
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseButtonEventArgs | The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was pressed. |
OnMouseLeftButtonUp(MouseButtonEventArgs)
Invoked when an unhandled MouseLeftButtonUp routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseButtonEventArgs | The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was released. |
OnMouseMove(MouseEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.MouseMove 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 override void OnMouseMove(MouseEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseEventArgs | The MouseEventArgs that contains the event data. |
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 |
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 | Element used to display the specified item. |
| item | object | Specified item. |
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 |
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
PageCurlActivating
Occurs when a page is about to curl.
public event EventHandler<CancelBookPageRoutedEventArgs> PageCurlActivating
Event Type
PageCurlDeactivated
Occurs when a page is no longer curled.
public event EventHandler<BookPageRoutedEventArgs> PageCurlDeactivated
Event Type
PageFlipped
Occurs when a page has flipped.
public event EventHandler<BookPageRoutedEventArgs> PageFlipped
Event Type
PageFlipping
Occurs when a page is about to flip.
public event EventHandler<CancelBookPageRoutedEventArgs> PageFlipping
Event Type
SelectedViewChanged
Occurs when the selected view has changed.
public event EventHandler<PropertyChangedRoutedEventArgs<int>> SelectedViewChanged
Event Type
SelectedViewChanging
Occurs when the selected view is about to change.
public event EventHandler<PropertyChangingRoutedEventArgs<int>> SelectedViewChanging
Event Type
Fields
AnimationStateProperty
Defines the AnimationState property.
public static readonly DependencyProperty AnimationStateProperty
CornerRadiusProperty
Defines the CornerRadius property.
public static readonly DependencyProperty CornerRadiusProperty
HotspotExtentProperty
Defines the HotspotExtent property.
public static readonly DependencyProperty HotspotExtentProperty
IsFirstPageFrontProperty
Defines the IsFirstPageFront property.
public static readonly DependencyProperty IsFirstPageFrontProperty
OrientationProperty
Defines the Orientation property.
public static readonly DependencyProperty OrientationProperty
PageCurlActivatedEvent
Defines the PageCurlActivated routed event.
public static readonly RoutedEvent PageCurlActivatedEvent
PageCurlActivatingEvent
Defines the PageCurlActivating routed event.
public static readonly RoutedEvent PageCurlActivatingEvent
PageCurlDeactivatedEvent
Defines the PageCurlDeactivated routed event.
public static readonly RoutedEvent PageCurlDeactivatedEvent
PageDepthProperty
Defines the PageDepth property.
public static readonly DependencyProperty PageDepthProperty
PageFlippedEvent
Defines the PageFlipped routed event.
public static readonly RoutedEvent PageFlippedEvent
PageFlippingEvent
Defines the PageFlipping routed event.
public static readonly RoutedEvent PageFlippingEvent
PendingViewIndexProperty
Defines the PendingViewIndex property.
public static readonly DependencyProperty PendingViewIndexProperty
SelectedBackIndexProperty
Defines the SelectedBackIndex property.
public static readonly DependencyProperty SelectedBackIndexProperty
SelectedBackItemProperty
Defines the SelectedBackItem property.
public static readonly DependencyProperty SelectedBackItemProperty
SelectedFrontIndexProperty
Defines the SelectedFrontIndex property.
public static readonly DependencyProperty SelectedFrontIndexProperty
SelectedFrontItemProperty
Defines the SelectedFrontItem property.
public static readonly DependencyProperty SelectedFrontItemProperty
SelectedViewChangedEvent
Defines the SelectedViewChanged routed event.
public static readonly RoutedEvent SelectedViewChangedEvent
SelectedViewChangingEvent
Defines the SelectedViewChanging routed event.
public static readonly RoutedEvent SelectedViewChangingEvent
SelectedViewIndexProperty
Defines the SelectedViewIndex property.
public static readonly DependencyProperty SelectedViewIndexProperty