C# Класс BaconographyWP8.Common.ReorderListBox

Наследование: System.Windows.Controls.ListBox
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
AutoScrollMarginProperty System.Windows.DependencyProperty
IsReorderEnabledProperty System.Windows.DependencyProperty

Открытые методы

Метод Описание
AnimateRearrange ( Duration animationDuration, System.Action rearrangeAction ) : void

Animates movements, insertions, or deletions in the list.

The animations are as follows: - Inserted items fade in while later items slide down to make space. - Removed items fade out while later items slide up to close the gap. - Moved items slide from their previous location to their new location. - Moved items which move out of or in to the visible area also fade out / fade in while sliding.

The rearrange action callback is called in the middle of the rearrange process. That callback may make any number of changes to the list source, in any order. After the rearrange action callback returns, the net result of all changes will be detected and included in a dynamically generated rearrange animation.

Multiple calls to this method in quick succession will be automatically queued up and executed in turn to avoid any possibility of conflicts. (If simultaneous rearrange animations are desired, use a single call to AnimateRearrange with a rearrange action callback that does both operations.)

GetViewIndexRange ( bool includePartial, int &firstIndex, int &lastIndex ) : void

Gets the indices of the first and last items in the view based on the current scroll position.

OnApplyTemplate ( ) : void

Applies the control template, gets required template parts, and hooks up the drag events.

ReorderListBox ( ) : System

Creates a new ReorderListBox and sets the default style key. The style key is used to locate the control template in Generic.xaml.

Защищенные методы

Метод Описание
ClearContainerForItemOverride ( DependencyObject element, object item ) : void

Called when an item container (ReorderListBoxItem) is being removed from the list panel. This may be because the item was removed from the list or because the item is now outside the virtualization region (because ListBox uses a VirtualizingStackPanel as its items panel).

GetContainerForItemOverride ( ) : DependencyObject
IsItemItsOwnContainerOverride ( object item ) : bool
OnIsReorderEnabledChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
PrepareContainerForItemOverride ( DependencyObject element, object item ) : void

Ensures that a possibly-recycled item container (ReorderListBoxItem) is ready to display a list item.

Приватные методы

Метод Описание
AnimateDrop ( ReorderListBoxItem itemContainer ) : void

Slides the drag indicator (item snapshot) to the location of the dropped item, then performs the visibility swap and removes the dragging visual state.

AnimateNextRearrange ( ) : void

Checks if there's another rearrange action waiting in the queue, and if so executes it next.

AnimateRearrangeInternal ( System.Action rearrangeAction, Duration animationDuration ) : void

Orchestrates the rearrange animation process.

BuildRearrangeMap ( int viewFirstIndex, int viewLastIndex ) : RearrangeItemInfo[]

Collects information about items and their positions before any changes are made.

BuildRearrangeMap2 ( RearrangeItemInfo map, int viewFirstIndex, int viewLastIndex ) : RearrangeItemInfo[]

Collects information about the NEW items and their NEW positions after changes were made.

ClearDropTarget ( ) : void

Hides any drop-indicators that are currently visible.

CreateRearrangeStoryboard ( IEnumerable visibleMoves, Duration animationDuration ) : System.Windows.Media.Animation.Storyboard

Creates a storyboard to animate the visible moves of a rearrange.

DragScroll ( ) : void

Automatically scrolls for as long as the drag is held within the margin. The speed of the scroll is adjusted based on the depth into the margin.

FindViewLastIndex ( int firstIndex ) : int

Finds the index of the last visible item by starting at the first index and comparing the bounds of each following item to the ScrollViewer bounds.

This method is less efficient than the hit-test method used by GetViewIndexRange() above, but it works when the controls haven't actually been rendered yet, while the other doesn't.

GetHostCoordinates ( Point point ) : Point

Gets host coordinates, adjusting for orientation. This is helpful when identifying what controls are under a point.

MoveItem ( object item, int toIndex ) : bool

Moves an item to a specified index in the source list.

UpdateDropTarget ( double dragItemOffset, bool showTransition ) : void

Updates spacing (drop target indicators) surrounding the targeted region.

UpdateDropTargetIndex ( ReorderListBoxItem targetItemContainer, bool after ) : void

Updates the targeted index -- that is the index where the item will be moved to if dropped at this point.

dragInterceptor_ManipulationCompleted ( object sender, System.Windows.Input.ManipulationCompletedEventArgs e ) : void

Called when the user releases a drag. Moves the item within the source list and then resets everything.

dragInterceptor_ManipulationDelta ( object sender, System.Windows.Input.ManipulationDeltaEventArgs e ) : void

Called when the user drags on (or from) the transparent drag-interceptor. Moves the item (actually a rendered snapshot of the item) according to the drag delta.

dragInterceptor_ManipulationStarted ( object sender, System.Windows.Input.ManipulationStartedEventArgs e ) : void

Called when the user presses down on the transparent drag-interceptor. Identifies the targed drag handle and list item and prepares for a drag operation.

Описание методов

AnimateRearrange() публичный Метод

Animates movements, insertions, or deletions in the list.
The animations are as follows: - Inserted items fade in while later items slide down to make space. - Removed items fade out while later items slide up to close the gap. - Moved items slide from their previous location to their new location. - Moved items which move out of or in to the visible area also fade out / fade in while sliding.

The rearrange action callback is called in the middle of the rearrange process. That callback may make any number of changes to the list source, in any order. After the rearrange action callback returns, the net result of all changes will be detected and included in a dynamically generated rearrange animation.

Multiple calls to this method in quick succession will be automatically queued up and executed in turn to avoid any possibility of conflicts. (If simultaneous rearrange animations are desired, use a single call to AnimateRearrange with a rearrange action callback that does both operations.)

public AnimateRearrange ( Duration animationDuration, System.Action rearrangeAction ) : void
animationDuration Duration Duration of the animation.
rearrangeAction System.Action Performs the actual rearrange on the list source.
Результат void

ClearContainerForItemOverride() защищенный Метод

Called when an item container (ReorderListBoxItem) is being removed from the list panel. This may be because the item was removed from the list or because the item is now outside the virtualization region (because ListBox uses a VirtualizingStackPanel as its items panel).
protected ClearContainerForItemOverride ( DependencyObject element, object item ) : void
element System.Windows.DependencyObject
item object
Результат void

GetContainerForItemOverride() защищенный Метод

protected GetContainerForItemOverride ( ) : DependencyObject
Результат System.Windows.DependencyObject

GetViewIndexRange() публичный Метод

Gets the indices of the first and last items in the view based on the current scroll position.
public GetViewIndexRange ( bool includePartial, int &firstIndex, int &lastIndex ) : void
includePartial bool True to include items that are partially obscured at the top and bottom, /// false to include only items that are completely in view.
firstIndex int Returns the index of the first item in view (or -1 if there are no items).
lastIndex int Returns the index of the last item in view (or -1 if there are no items).
Результат void

IsItemItsOwnContainerOverride() защищенный Метод

protected IsItemItsOwnContainerOverride ( object item ) : bool
item object
Результат bool

OnApplyTemplate() публичный Метод

Applies the control template, gets required template parts, and hooks up the drag events.
public OnApplyTemplate ( ) : void
Результат void

OnIsReorderEnabledChanged() защищенный Метод

protected OnIsReorderEnabledChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
e System.Windows.DependencyPropertyChangedEventArgs
Результат void

PrepareContainerForItemOverride() защищенный Метод

Ensures that a possibly-recycled item container (ReorderListBoxItem) is ready to display a list item.
protected PrepareContainerForItemOverride ( DependencyObject element, object item ) : void
element System.Windows.DependencyObject
item object
Результат void

ReorderListBox() публичный Метод

Creates a new ReorderListBox and sets the default style key. The style key is used to locate the control template in Generic.xaml.
public ReorderListBox ( ) : System
Результат System

Описание свойств

AutoScrollMarginProperty публичное статическое свойство

public static DependencyProperty,System.Windows AutoScrollMarginProperty
Результат System.Windows.DependencyProperty

IsReorderEnabledProperty публичное статическое свойство

public static DependencyProperty,System.Windows IsReorderEnabledProperty
Результат System.Windows.DependencyProperty