ListView¶
Namespace: WellFired.Guacamole
Implements: WellFired.Guacamole.Views.IListensToVdsChanges, WellFired.Guacamole.Views.IListView
Inherits: WellFired.Guacamole.Views.ItemsView
Description¶
The ListView is a View that supports dynamic content and scrollable views. It can have an Orientation of either Horizontal or Vertical. On top of that, the view can be set to have a dynamic data source, if the ItemSource is an ObservableCollection, when you add, remove, insert or in any way change that collection, the ListView will be set to update dynamically. The ListView contains a series of visible cells. These visible cells are recycled for performance reasons. To calculate what should be visible we use the VdsCalculator, that operates on a Visual Data Set. If our view is big enough to view 4 entries at once, our VDS will be the four indicies into this data those visible elements represent. Entries leaving or entering the VDS are what trigger new cells to be created.
public-static-attrib¶
readonly BindableProperty | ScrollOffsetProperty |
readonly BindableProperty | SpacingProperty |
readonly BindableProperty | SelectedItemProperty |
readonly BindableProperty | SelectedItemsProperty |
readonly BindableProperty | EntrySizeProperty |
readonly BindableProperty | HeaderSizeProperty |
readonly BindableProperty | OrientationProperty |
readonly BindableProperty | AvailableSpaceProperty |
readonly BindableProperty | CanScrollProperty |
readonly BindableProperty | CanMultiSelectProperty |
readonly BindableProperty | ScrollBarBackgroundColorProperty |
readonly BindableProperty | ScrollBarOutlineColorProperty |
readonly BindableProperty | ScrollBarCornerRadiusProperty |
readonly BindableProperty | ScrollBarCornerMaskProperty |
readonly BindableProperty | ScrollBarOutlineThicknessProperty |
readonly BindableProperty | ScrollBarOutlineMaskProperty |
readonly BindableProperty | ScrollBarSizeProperty |
readonly BindableProperty | ShouldShowScrollBarProperty |
Properties¶
UIColor | ScrollBarBackgroundColor { get; set; } |
int | Spacing { get; set; } |
INotifyPropertyChanged | SelectedItem { get; set; } |
:ref:`ObservableCollection<classwellfired_guacamole_data_collection_observablecollection>`< INotifyPropertyChanged > | SelectedItems { get; set; } |
int | EntrySize { get; set; } |
int | HeaderSize { get; set; } |
OrientationOptions | Orientation { get; set; } |
float | AvailableSpace { get; set; } |
bool | CanScroll { get; set; } |
float | ScrollOffset { get; set; } |
bool | CanMultiSelect { get; set; } |
UIColor | ScrollBarOutlineColor { get; set; } |
double | ScrollBarCornerRadius { get; set; } |
CornerMask | ScrollBarCornerMask { get; set; } |
double | ScrollBarOutlineThickness { get; set; } |
OutlineMask | ScrollBarOutlineMask { get; set; } |
int | ScrollBarSize { get; set; } |
bool | ShouldShowScrollBar { get; set; } |
int | TotalContentSize { get; set; } |
float | InitialOffset { get; set; } |
Action< INotifyPropertyChanged, SelectedItemChangedEventArgs > | OnItemSelected { get; set; } |
Public Methods¶
ListView ( ) | |
void | ScrollTo ( object item ) |
int | GetEntrySizeFor ( object data ) |
void | ItemLeftVds ( int vdsIndex ) |
void | ItemEnteredVds ( int vdsIndex, bool front ) |
protected-func¶
override void | ItemSourceChanged ( ) |
override void | ItemSourceCleared ( ) |
override void | ItemAdded ( object item, int index ) |
override void | ItemRemoved ( object item ) |
override void | ItemReplaced ( object oldItem, object newItem, int index ) |
override void | OnBindablePropertyChanged ( object sender, PropertyChangedEventArgs e ) |
Breakdown¶
- readonly BindableProperty CanMultiSelectProperty
- readonly BindableProperty ScrollOffsetProperty
- readonly BindableProperty SelectedItemProperty
- readonly BindableProperty SelectedItemsProperty
- readonly BindableProperty EntrySizeProperty
- readonly BindableProperty HeaderSizeProperty
- readonly BindableProperty OrientationProperty
- readonly BindableProperty AvailableSpaceProperty
- readonly BindableProperty CanScrollProperty
- readonly BindableProperty SpacingProperty
- readonly BindableProperty ScrollBarBackgroundColorProperty
- readonly BindableProperty ScrollBarOutlineColorProperty
- readonly BindableProperty ScrollBarCornerRadiusProperty
- readonly BindableProperty ScrollBarCornerMaskProperty
- readonly BindableProperty ScrollBarOutlineThicknessProperty
- readonly BindableProperty ScrollBarOutlineMaskProperty
- readonly BindableProperty ScrollBarSizeProperty
- readonly BindableProperty ShouldShowScrollBarProperty
- bool CanMultiSelect { get; set; }
- UIColor ScrollBarBackgroundColor { get; set; }
- INotifyPropertyChanged SelectedItem { get; set; }
- :ref:`ObservableCollection<classwellfired_guacamole_data_collection_observablecollection>`< INotifyPropertyChanged > SelectedItems { get; set; }
int EntrySize { get; set; }
Description
The size of one Entry into this List View, for the moment, each entry should be the same size, though this might change in the future. The EntrySize refers to the size in the direction of Orientation. I.E. If the Orientation is Vertical, the EntrySize is the EntryHeight, if the Orientation is Horizontal, the EntrySize refers to the width.
int HeaderSize { get; set; }
Description
The size of one Header Entry into this List View, for the moment, each Header Entry should be the same size, though this might change in the future. The HeaderSize refers to the size in the direction of Orientation. I.E. If the Orientation is Vertical, the HeaderSize is the EntryHeight, if the Orientation is Horizontal, the HeaderSize refers to the width.
- OrientationOptions Orientation { get; set; }
- float AvailableSpace { get; set; }
- bool CanScroll { get; set; }
- float ScrollOffset { get; set; }
- int Spacing { get; set; }
- UIColor ScrollBarOutlineColor { get; set; }
- double ScrollBarCornerRadius { get; set; }
- CornerMask ScrollBarCornerMask { get; set; }
- double ScrollBarOutlineThickness { get; set; }
- OutlineMask ScrollBarOutlineMask { get; set; }
- int ScrollBarSize { get; set; }
- bool ShouldShowScrollBar { get; set; }
int TotalContentSize { get; set; }
Description
The total width for horizontal list view, or the total height for vertical list view, after suming up the size of each items.
float InitialOffset { get; set; }
Description
The position where the first child should be rendered. A negative value indicate that the first child is rendered above the list view position (or on the left for a horizontal list view), meaning part of it is outside of the list view. This happens when scrolling, or when adding and removing children from the list of cells to render.
- Action< INotifyPropertyChanged, SelectedItemChangedEventArgs > OnItemSelected { get; set; }
- ListView ( )
void ScrollTo ( object item )
Description
ScrollTo a specific item.
Parameters
item The item you wish to scroll to. This should be the items bindableObject, not the visual element.
int GetEntrySizeFor ( object data )
Description
This method will return the EntrySize for a given element in the ItemSource if grouping is not enabled, we will always immediately return the default entry size, if grouping is enabled, we shall return either the HeaderSize or the EntrySize depending on which element is passed.
Parameters
data The Bound object whos size we want to check.
void ItemLeftVds ( int vdsIndex )
Description
When an item becomes invisible, we cache the cell and remove it from the children.
Parameters
vdsIndex
void ItemEnteredVds ( int vdsIndex, bool front )
Description
When an item becomes visible, we get a cell from the cache and we inject the data in it.
Parameters
vdsIndex front indicate if the item added is on the top of already visible children, or if it is at the bottom (left or right for horizontal list view)
override void ItemSourceChanged ( )
Description
This is called when the whole ItemSource is changed. I.E. ItemSource = new collection();
override void ItemSourceCleared ( )
Description
This is called when the ItemSource is cleared. I.E. ItemSource.Clear(); Note : This is only called if ItemSource is an ObservableCollection.
override void ItemAdded ( object item, int index )
Description
This is called when a new Item is added to the ItemSource. Note : This is only called if ItemSource is an ObservableCollection.
Parameters
item The new item index The new position this element was added at.
override void ItemRemoved ( object item )
Description
This is called when an item is removed from the ItemSource Note : This is only called if ItemSource is an ObservableCollection.
Parameters
item The removed Item
override void ItemReplaced ( object oldItem, object newItem, int index )
Description
This is called when an item is replaced within the ItemSource. Note : This is only called if ItemSource is an ObservableCollection.
Parameters
oldItem The item that used to exist newItem The new item index The index into the ItemSource that you will find this item
- override void OnBindablePropertyChanged ( object sender, PropertyChangedEventArgs e )