Classe ListView
TOC
Comprimi il sommario
Espandi il sommario

ListView Class

Rappresenta un controllo per la visualizzazione di un elenco verticale di elementi di dati.

Ereditarietà

Object
  DependencyObject
    UIElement
      FrameworkElement
        Control
          ItemsControl
            Selector
              ListViewBase
                ListView

Sintassi


public class ListView : ListViewBase,
    ISemanticZoomInformation


<ListView .../>
-or-
<ListView ...>
  oneOrMoreComponents
</ListView>

XAML Values

oneOrMoreComponents

Uno o più componenti che stabiliscono le caratteristiche ItemsControl della visualizzazione. Ad esempio, ListView potrebbe contenere elementi oggetto che eseguono le definizioni inline per la proprietà GroupStyle, ItemTemplate, ItemContainerStyle o ItemsPanel.

ListView può anche contenere elementi oggetto che dichiarano il contenuto effettivo visualizzato. Questi elementi oggetto diventano elementi della raccolta Items. È più facile, tuttavia, che tale contenuto derivi da un'origine di associazione dati.

Attributi

MarshalingBehaviorAttribute(Agile)
ThreadingAttribute(Both)
VersionAttribute(NTDDI_WIN8)
WebHostHiddenAttribute()

Membri

Il ListViewClasse dispone di questi tipi di membri:

Costruttori

Il ListViewClasse dispone di questi costruttori.

CostruttoreDescrizione
ListView Initializes a new instance of the ListView class.

 

Eventi

Il ListViewClasse dispone di questi eventi.

EventoDescrizione
DoubleTapped Occurs when an otherwise unhandled DoubleTap interaction occurs over the hit test area of this element. (Ereditato da UIElement)
DragEnter Occurs when the input system reports an underlying drag event with this element as the target. (Ereditato da UIElement)
DragItemsStarting Occurs when a drag operation that involves one of the items in the view is initiated. (Ereditato da ListViewBase)
DragLeave Occurs when the input system reports an underlying drag event with this element as the origin. (Ereditato da UIElement)
DragOver Occurs when the input system reports an underlying drag event with this element as the potential drop target. (Ereditato da UIElement)
Drop Occurs when the input system reports an underlying drop event with this element as the drop target. (Ereditato da UIElement)
GotFocus Occurs when a UIElement receives focus. (Ereditato da UIElement)
Holding Occurs when an otherwise unhandled Hold interaction occurs over the hit test area of this element. (Ereditato da UIElement)
IsEnabledChanged Occurs when the IsEnabled property changes. (Ereditato da Control)
ItemClick Occurs when an item in the list view receives an interaction, and the IsItemClickEnabled property is true. (Ereditato da ListViewBase)
KeyDown Occurs when a keyboard key is pressed while the UIElement has focus. (Ereditato da UIElement)
KeyUp Occurs when a keyboard key is released while the UIElement has focus. (Ereditato da UIElement)
LayoutUpdated Occurs when the layout of the visual tree changes. (Ereditato da FrameworkElement)
Loaded Occurs when a FrameworkElement has been constructed and added to the object tree, and is ready for interaction. (Ereditato da FrameworkElement)
LostFocus Occurs when a UIElement loses focus. (Ereditato da UIElement)
ManipulationCompleted Occurs when a manipulation on the UIElement is complete. (Ereditato da UIElement)
ManipulationDelta Occurs when the input device changes position during a manipulation. (Ereditato da UIElement)
ManipulationInertiaStarting Occurs when the input device loses contact with the UIElement object during a manipulation and inertia begins. (Ereditato da UIElement)
ManipulationStarted Occurs when an input device begins a manipulation on the UIElement. (Ereditato da UIElement)
ManipulationStarting Occurs when the manipulation processor is first created. (Ereditato da UIElement)
PointerCanceled Occurs when a pointer that made contact abnormally loses contact. (Ereditato da UIElement)
PointerCaptureLost Occurs when pointer capture previously held by this element moves to another element or elsewhere. (Ereditato da UIElement)
PointerEntered Occurs when a pointer enters the hit test area of this element. (Ereditato da UIElement)
PointerExited Occurs when a pointer leaves the hit test area of this element. (Ereditato da UIElement)
PointerMoved Occurs when a pointer moves while the pointer remains within the hit test area of this element. (Ereditato da UIElement)
PointerPressed Occurs when the pointer device initiates a Press action within this element. (Ereditato da UIElement)
PointerReleased Occurs when the pointer device that previously initiated a Press action is released, while within this element. (Ereditato da UIElement)
PointerWheelChanged Occurs when the delta value of a pointer wheel changes. (Ereditato da UIElement)
RightTapped Occurs when a right-tap input stimulus happens while the pointer is over the element. (Ereditato da UIElement)
SelectionChanged Occurs when the currently selected item changes. (Ereditato da Selector)
SizeChanged Occurs when either the ActualHeight or the ActualWidth property changes value on a FrameworkElement. (Ereditato da FrameworkElement)
Tapped Occurs when an otherwise unhandled Tap interaction occurs over the hit test area of this element. (Ereditato da UIElement)
Unloaded Occurs when this object is no longer connected to the main object tree. (Ereditato da FrameworkElement)

 

Metodi

The ListView Classe dispone di questi metodi. Eredita inoltre i metodi da Object Classe.

MetodoDescrizione
AddHandler Adds a routed event handler for a specified routed event, adding the handler to the handler collection on the current element. Specify handledEventsToo as true to have the provided handler be invoked even if the event is handled elsewhere. (Ereditato da UIElement)
ApplyTemplate Loads the relevant control template so that its parts can be referenced. (Ereditato da Control)
Arrange Positions child objects and determines a size for a UIElement. Parent objects that implement custom layout for their child elements should call this method from their layout override implementations to form a recursive layout update. (Ereditato da UIElement)
ArrangeOverride Provides the behavior for the Arrange pass of layout. Classes can override this method to define their own Arrange pass behavior. (Ereditato da FrameworkElement)
CapturePointer Sets pointer capture to a UIElement. Once captured, only the element that has capture will fire pointer-related events. (Ereditato da UIElement)
ClearContainerForItemOverride Undoes the effects of the PrepareContainerForItemOverride method. (Ereditato da ItemsControl)
ClearValue Clears the local value of a dependency property. (Ereditato da DependencyObject)
CompleteViewChange Changes related aspects of presentation when the overall view for a SemanticZoom changes. (Ereditato da ListViewBase)
CompleteViewChangeFrom Completes item-wise operations that are related to a view change when the ListViewBase instance is the source view and the new view is a potentially different implementing view. (Ereditato da ListViewBase)
CompleteViewChangeTo Completes item-wise operations that are related to a view change when the ListViewBase instance is the destination view and the source view is a potentially different implementing view. (Ereditato da ListViewBase)
FindName Retrieves an object that has the specified identifier name. (Ereditato da FrameworkElement)
FindSubElementsForTouchTargeting Enables a UIElement subclass to expose child elements that assist with resolving touch targeting. (Ereditato da UIElement)
Focus Attempts to set the focus on the control. (Ereditato da Control)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Ereditato da DependencyObject)
GetContainerForItemOverride Creates or identifies the element that is used to display the given item. (Ereditato da ItemsControl)
GetTemplateChild Retrieves the named element in the instantiated ControlTemplate visual tree. (Ereditato da Control)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Ereditato da DependencyObject)
InitializeViewChange Initializes the changes to related aspects of presentation (such as scrolling UI or state) when the overall view for a SemanticZoom is about to change. (Ereditato da ListViewBase)
InvalidateArrange Invalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously. (Ereditato da UIElement)
InvalidateMeasure Invalidates the measurement state (layout) for a UIElement. (Ereditato da UIElement)
IsItemItsOwnContainerOverride Determines whether the specified item is (or is eligible to be) its own container. (Ereditato da ItemsControl)
LoadMoreItemsAsync Initiates the asynchronous request to load more data items, in accordance with the active incremental loading settings. (Ereditato da ListViewBase)
MakeVisible Forces content in the view to scroll until the item that's specified by SemanticZoomLocation is visible. Also focuses the item if it finds the item. (Ereditato da ListViewBase)
Measure Updates the DesiredSize of a UIElement. Typically, objects that implement custom layout for their layout children call this method from their own MeasureOverride implementations to form a recursive layout update. (Ereditato da UIElement)
MeasureOverride Provides the behavior for the Measure pass of the layout cycle. Classes can override this method to define their own Measure pass behavior. (Ereditato da FrameworkElement)
OnApplyTemplate Invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate. In simplest terms, this means the method is called just before a UI element displays in your app. Override this method to influence the default post-template logic of a class. (Ereditato da FrameworkElement)
OnCreateAutomationPeer When implemented in a derived class, returns class-specific AutomationPeer implementations for the Microsoft UI Automation infrastructure. (Ereditato da UIElement)
OnDisconnectVisualChildren Override this method to implement how layout and logic should behave when items are removed from a class-specific content or children property. (Ereditato da UIElement)
OnDoubleTapped Called before the DoubleTapped event occurs. (Ereditato da Control)
OnDragEnter Called before the DragEnter event occurs. (Ereditato da Control)
OnDragLeave Called before the DragLeave event occurs. (Ereditato da Control)
OnDragOver Called before the DragOver event occurs. (Ereditato da Control)
OnDrop Called before the Drop event occurs. (Ereditato da Control)
OnGotFocus Called before the GotFocus event occurs. (Ereditato da Control)
OnGroupStyleSelectorChanged Invoked when the value of the GroupStyleSelector property changes. (Ereditato da ItemsControl)
OnHolding Called before the Holding event occurs. (Ereditato da Control)
OnItemContainerStyleChanged Invoked when the value of the ItemContainerStyle property changes. (Ereditato da ItemsControl)
OnItemContainerStyleSelectorChanged Invoked when the value of the ItemContainerStyleSelector property changes. (Ereditato da ItemsControl)
OnItemsChanged Invoked when the value of the Items property changes. (Ereditato da ItemsControl)
OnItemTemplateChanged Invoked when the value of the ItemTemplate property changes. (Ereditato da ItemsControl)
OnItemTemplateSelectorChanged Invoked when the value of the ItemTemplateSelector property changes. (Ereditato da ItemsControl)
OnKeyDown Called before the KeyDown event occurs. (Ereditato da Control)
OnKeyUp Called before the KeyUp event occurs. (Ereditato da Control)
OnLostFocus Called before the LostFocus event occurs. (Ereditato da Control)
OnManipulationCompleted Called before the ManipulationCompleted event occurs. (Ereditato da Control)
OnManipulationDelta Called before the ManipulationDelta event occurs. (Ereditato da Control)
OnManipulationInertiaStarting Called before the ManipulationInertiaStarting event occurs. (Ereditato da Control)
OnManipulationStarted Called before the ManipulationStarted event occurs. (Ereditato da Control)
OnManipulationStarting Called before the ManipulationStarting event occurs. (Ereditato da Control)
OnPointerCanceled Called before the PointerCanceled event occurs. (Ereditato da Control)
OnPointerCaptureLost Called before the PointerCaptureLost event occurs. (Ereditato da Control)
OnPointerEntered Called before the PointerEntered event occurs. (Ereditato da Control)
OnPointerExited Called before the PointerExited event occurs. (Ereditato da Control)
OnPointerMoved Called before the PointerMoved event occurs. (Ereditato da Control)
OnPointerPressed Called before the PointerPressed event occurs. (Ereditato da Control)
OnPointerReleased Called before the PointerReleased event occurs. (Ereditato da Control)
OnPointerWheelChanged Called before the PointerWheelChanged event occurs. (Ereditato da Control)
OnRightTapped Called before the RightTapped event occurs. (Ereditato da Control)
OnTapped Called before the Tapped event occurs. (Ereditato da Control)
PrepareContainerForItemOverride Prepares the specified element to display the specified item. (Ereditato da ItemsControl)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Ereditato da DependencyObject)
ReleasePointerCapture Releases pointer captures for capture of one specific pointer by this UIElement. (Ereditato da UIElement)
ReleasePointerCaptures Releases all pointer captures held by this element. (Ereditato da UIElement)
RemoveHandler Removes the specified routed event handler from this UIElement. Typically the handler in question was added by AddHandler. (Ereditato da UIElement)
ScrollIntoView(Object) Scrolls the list to bring the specified data item into view. (Ereditato da ListViewBase)
ScrollIntoView(Object, ScrollIntoViewAlignment) Scrolls the list to bring the specified data item into view with the specified alignment. (Ereditato da ListViewBase)
SelectAll Selects all the items in a view. (Ereditato da ListViewBase)
SetBinding Attaches a binding to a FrameworkElement, using the provided binding object. (Ereditato da FrameworkElement)
SetValue Sets the local value of a dependency property on a DependencyObject. (Ereditato da DependencyObject)
StartViewChangeFrom Initializes item-wise operations that are related to a view change when the ListViewBase instance is the source view and the pending destination view is a potentially different implementing view. (Ereditato da ListViewBase)
StartViewChangeTo Initializes item-wise operations that are related to a view change when the source view is a different view and the pending destination view is the ListViewBase instance. (Ereditato da ListViewBase)
TransformToVisual Returns a transform object that can be used to transform coordinates from the UIElement to the specified object. (Ereditato da UIElement)
UpdateLayout Ensures that all positions of child objects of a UIElement are properly updated for layout. (Ereditato da UIElement)

 

Proprietà

ListViewClasse dispone di queste proprietà.

ProprietàTipo accessoDescrizione

ActualHeight

Sola letturaGets the rendered height of a FrameworkElement. (Ereditato da FrameworkElement)

ActualWidth

Sola letturaGets the rendered width of a FrameworkElement. (Ereditato da FrameworkElement)

AllowDrop

Lettura/scritturaGets or sets a value that determines whether this UIElement can be a drop target for purposes of drag-and-drop operations. (Ereditato da UIElement)

Background

Lettura/scritturaGets or sets a brush that provides the background of the control. (Ereditato da Control)

BaseUri

Sola letturaGets a Uniform Resource Identifier (URI) that represents the base Uniform Resource Identifier (URI) for an XAML-constructed object at XAML load time. This property is useful for Uniform Resource Identifier (URI) resolution at run time. (Ereditato da FrameworkElement)

BorderBrush

Lettura/scritturaGets or sets a brush that describes the border background of a control. (Ereditato da Control)

BorderThickness

Lettura/scritturaGets or sets the border thickness of a control. (Ereditato da Control)

CacheMode

Lettura/scritturaGets or sets a value that indicates that rendered content should be cached as a composited bitmap when possible. (Ereditato da UIElement)

CanDragItems

Lettura/scritturaGets or sets a value that indicates whether items in the view can be dragged as data payload. (Ereditato da ListViewBase)

CanDragItemsProperty

Sola letturaIdentifies the CanDragItems dependency property. (Ereditato da ListViewBase)

CanReorderItems

Lettura/scritturaGets or sets a value that indicates whether items in the view can be reordered through user interaction. (Ereditato da ListViewBase)

CanReorderItemsProperty

Sola letturaIdentifies the CanReorderItems dependency property. (Ereditato da ListViewBase)

CharacterSpacing

Lettura/scritturaGets or sets the uniform spacing between characters, in units of 1/1000 of an em. (Ereditato da Control)

Clip

Lettura/scritturaGets or sets the RectangleGeometry used to define the outline of the contents of a UIElement. (Ereditato da UIElement)

DataContext

Lettura/scritturaGets or sets the data context for a FrameworkElement when it participates in data binding. (Ereditato da FrameworkElement)

DataFetchSize

Lettura/scritturaGets or sets the amount of data to fetch for virtualizing/prefetch operations. (Ereditato da ListViewBase)

DataFetchSizeProperty

Sola letturaIdentifies the DataFetchSize dependency property. (Ereditato da ListViewBase)

DefaultStyleKey

Lettura/scritturaGets or sets the key that references the default style for the control. (Ereditato da Control)

DesiredSize

Sola letturaGets the size that this UIElement computed during the measure pass of the layout process. (Ereditato da UIElement)

Dispatcher

Sola letturaGets the CoreDispatcher that this object is associated with. (Ereditato da DependencyObject)

DisplayMemberPath

Lettura/scritturaGets or sets the name or path of the property that is displayed for each data item. (Ereditato da ItemsControl)

FlowDirection

Lettura/scritturaGets or sets the direction in which text and other UI elements flow within any parent element that controls their layout. This property can be set to either LeftToRight or RightToLeft. Setting FlowDirection to RightToLeft on any element sets the alignment to the right, the reading order to right-to-left and the layout of the control to flow from right to left. (Ereditato da FrameworkElement)

FocusState

Sola letturaGets a value that specifies whether this control has focus, and the mode by which focus was obtained. (Ereditato da Control)

FontFamily

Lettura/scritturaGets or sets the font used to display text in the control. (Ereditato da Control)

FontSize

Lettura/scritturaGets or sets the size of the text in this control. (Ereditato da Control)

FontStretch

Lettura/scritturaGets or sets the degree to which a font is condensed or expanded on the screen. (Ereditato da Control)

FontStyle

Lettura/scritturaGets or sets the style in which the text is rendered. (Ereditato da Control)

FontWeight

Lettura/scritturaGets or sets the thickness of the specified font. (Ereditato da Control)

Foreground

Lettura/scritturaGets or sets a brush that describes the foreground color. (Ereditato da Control)

GroupStyle

Sola letturaGets a collection of GroupStyle objects that define the appearance of each level of groups. (Ereditato da ItemsControl)

GroupStyleSelector

Lettura/scritturaGets or sets a reference to a custom GroupStyleSelector logic class. The GroupStyleSelector returns different GroupStyle values to use for content based on the characteristics of that content. (Ereditato da ItemsControl)

Header

Lettura/scritturaGets or sets the content for the list header. (Ereditato da ListViewBase)

HeaderProperty

Sola letturaIdentifies the Header dependency property. (Ereditato da ListViewBase)

HeaderTemplate

Lettura/scritturaGets or sets the DataTemplate used to display the content of the view header. (Ereditato da ListViewBase)

HeaderTemplateProperty

Sola letturaIdentifies the HeaderTemplate dependency property. (Ereditato da ListViewBase)

HeaderTransitions

Lettura/scritturaGets or sets the collection of Transition style elements that apply to the view header. (Ereditato da ListViewBase)

HeaderTransitionsProperty

Sola letturaIdentifies the HeaderTransitions dependency property. (Ereditato da ListViewBase)

Height

Lettura/scritturaGets or sets the suggested height of a FrameworkElement. (Ereditato da FrameworkElement)

HorizontalAlignment

Lettura/scritturaGets or sets the horizontal alignment characteristics that are applied to a FrameworkElement when it is composed in a layout parent, such as a panel or items control. (Ereditato da FrameworkElement)

HorizontalContentAlignment

Lettura/scritturaGets or sets the horizontal alignment of the control's content. (Ereditato da Control)

IncrementalLoadingThreshold

Lettura/scritturaGets or sets the threshold range that governs when the ListViewBase class will begin to prefetch more items. (Ereditato da ListViewBase)

IncrementalLoadingThresholdProperty

Sola letturaIdentifies the IncrementalLoadingThreshold dependency property. (Ereditato da ListViewBase)

IncrementalLoadingTrigger

Lettura/scritturaGets or sets a value that indicates the conditions for prefetch operations by the ListViewBase class. (Ereditato da ListViewBase)

IncrementalLoadingTriggerProperty

Sola letturaIdentifies the IncrementalLoadingTrigger dependency property. (Ereditato da ListViewBase)

IsActiveView

Lettura/scritturaGets or sets a value that indicates whether the ListViewBase instance is the active view in its owning SemanticZoom. (Ereditato da ListViewBase)

IsActiveViewProperty

Sola letturaIdentifies the IsActiveView dependency property. (Ereditato da ListViewBase)

IsDoubleTapEnabled

Lettura/scritturaGets or sets a value that determines whether the DoubleTapped event can originate from that element. (Ereditato da UIElement)

IsEnabled

Lettura/scritturaGets or sets a value indicating whether the user can interact with the control. (Ereditato da Control)

IsGrouping

Sola letturaGets a value that indicates whether the control is using grouping. (Ereditato da ItemsControl)

IsHitTestVisible

Lettura/scritturaGets or sets whether the contained area of this UIElement can return true values for hit testing. (Ereditato da UIElement)

IsHoldingEnabled

Lettura/scritturaGets or sets a value that determines whether the Holding event can originate from that element. (Ereditato da UIElement)

IsItemClickEnabled

Lettura/scritturaGets or sets a value that indicates whether items in the view raise an ItemClick event in response to interaction. (Ereditato da ListViewBase)

IsItemClickEnabledProperty

Sola letturaIdentifies the IsItemClickEnabled dependency property. (Ereditato da ListViewBase)

IsRightTapEnabled

Lettura/scritturaGets or sets a value that determines whether the RightTapped event can originate from that element. (Ereditato da UIElement)

IsSwipeEnabled

Lettura/scritturaGets or sets a value that indicates whether the view supports discrete input processing for a swipe interaction. (Ereditato da ListViewBase)

IsSwipeEnabledProperty

Sola letturaIdentifies the IsSwipeEnabled dependency property. (Ereditato da ListViewBase)

IsSynchronizedWithCurrentItem

Lettura/scritturaGets or sets a value that indicates whether a Selector should keep the SelectedItem synchronized with the current item in the Items property. (Ereditato da Selector)

IsTabStop

Lettura/scritturaGets or sets a value that indicates whether a control is included in tab navigation. (Ereditato da Control)

IsTapEnabled

Lettura/scritturaGets or sets a value that determines whether the Tapped event can originate from that element. (Ereditato da UIElement)

IsZoomedInView

Lettura/scritturaGets or sets a value that indicates whether the ListViewBase instance is the zoomed-in view in its owning SemanticZoom. (Ereditato da ListViewBase)

IsZoomedInViewProperty

Sola letturaIdentifies the IsZoomedInView dependency property. (Ereditato da ListViewBase)

ItemContainerGenerator

Sola letturaGets the ItemContainerGenerator associated with this ItemsControl. (Ereditato da ItemsControl)

ItemContainerStyle

Lettura/scritturaGets or sets the style that is used when rendering the item containers. (Ereditato da ItemsControl)

ItemContainerStyleSelector

Lettura/scritturaGets or sets a reference to a custom StyleSelector logic class. The StyleSelector returns different Style values to use for the item container based on characteristics of the object being displayed. (Ereditato da ItemsControl)

ItemContainerTransitions

Lettura/scritturaGets or sets the collection of Transition style elements that apply to the item containers of an ItemsControl. (Ereditato da ItemsControl)

Items

Sola letturaGets the collection used to generate the content of the control. (Ereditato da ItemsControl)

ItemsPanel

Lettura/scritturaGets or sets the template that defines the panel that controls the layout of items. (Ereditato da ItemsControl)

ItemsSource

Lettura/scritturaGets or sets an object source used to generate the content of the ItemsControl. (Ereditato da ItemsControl)

ItemTemplate

Lettura/scritturaGets or sets the DataTemplate used to display each item. (Ereditato da ItemsControl)

ItemTemplateSelector

Lettura/scritturaGets or sets a reference to a custom DataTemplateSelector logic class. The DataTemplateSelector referenced by this property returns a template to apply to items. (Ereditato da ItemsControl)

Language

Lettura/scritturaGets or sets localization/globalization language information that applies to a FrameworkElement, and also to all child elements of the current FrameworkElement in the object representation and in UI. (Ereditato da FrameworkElement)

ManipulationMode

Lettura/scritturaGets or sets the ManipulationModes value used for UIElement behavior and interaction with gestures. (Ereditato da UIElement)

Margin

Lettura/scritturaGets or sets the outer margin of a FrameworkElement. (Ereditato da FrameworkElement)

MaxHeight

Lettura/scritturaGets or sets the maximum height constraint of a FrameworkElement. (Ereditato da FrameworkElement)

MaxWidth

Lettura/scritturaGets or sets the maximum width constraint of a FrameworkElement. (Ereditato da FrameworkElement)

MinHeight

Lettura/scritturaGets or sets the minimum height constraint of a FrameworkElement. (Ereditato da FrameworkElement)

MinWidth

Lettura/scritturaGets or sets the minimum width constraint of a FrameworkElement. (Ereditato da FrameworkElement)

Name

Lettura/scritturaGets or sets the identifying name of the object. When a XAML processor creates the object tree from XAML markup, run-time code can refer to the XAML-declared object by this name. (Ereditato da FrameworkElement)

Opacity

Lettura/scritturaGets or sets the degree of the object's opacity. (Ereditato da UIElement)

Padding

Lettura/scritturaGets or sets the padding inside a control. (Ereditato da Control)

Parent

Sola letturaGets the parent object of this FrameworkElement in the object tree. (Ereditato da FrameworkElement)

PointerCaptures

Sola letturaGets the set of all captured pointers, represented as Pointer values. (Ereditato da UIElement)

Projection

Lettura/scritturaGets or sets the perspective projection (3-D effect) to apply when rendering this element. (Ereditato da UIElement)

RenderSize

Sola letturaGets the final render size of a UIElement. (Ereditato da UIElement)

RenderTransform

Lettura/scritturaGets or sets transform information that affects the rendering position of a UIElement. (Ereditato da UIElement)

RenderTransformOrigin

Lettura/scritturaGets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement. (Ereditato da UIElement)

Resources

Lettura/scritturaGets the locally defined resource dictionary. In XAML, you can establish resource items as child object elements of a frameworkElement.Resources property element, through XAML implicit collection syntax. (Ereditato da FrameworkElement)

SelectedIndex

Lettura/scritturaGets or sets the index of the selected item. (Ereditato da Selector)

SelectedItem

Lettura/scritturaGets or sets the selected item. (Ereditato da Selector)

SelectedItems

Sola letturaGets the currently selected items. (Ereditato da ListViewBase)

SelectedValue

Lettura/scritturaGets or sets the value of the selected item, obtained by using the SelectedValuePath. (Ereditato da Selector)

SelectedValuePath

Lettura/scritturaGets or sets the property path that is used to get the SelectedValue property of the SelectedItem property. (Ereditato da Selector)

SelectionMode

Lettura/scritturaGets or sets the selection behavior for a ListViewBase instance. (Ereditato da ListViewBase)

SelectionModeProperty

Sola letturaIdentifies the SelectionMode dependency property. (Ereditato da ListViewBase)

SemanticZoomOwner

Lettura/scritturaGets or sets the SemanticZoom instance that hosts the ListViewBase. (Ereditato da ListViewBase)

SemanticZoomOwnerProperty

Sola letturaIdentifies the SemanticZoomOwner dependency property. (Ereditato da ListViewBase)

Style

Lettura/scritturaGets or sets an instance Style that is applied for this object during layout and rendering. (Ereditato da FrameworkElement)

TabIndex

Lettura/scritturaGets or sets a value that determines the order in which elements receive focus when the user navigates through controls by pressing the Tab key. (Ereditato da Control)

TabNavigation

Lettura/scritturaGets or sets a value that modifies how tabbing and TabIndex work for this control. (Ereditato da Control)

Tag

Lettura/scritturaGets or sets an arbitrary object value that can be used to store custom information about this object. (Ereditato da FrameworkElement)

Template

Lettura/scritturaGets or sets a control template. The control template defines the visual appearance of a control in UI, and is defined in XAML markup. (Ereditato da Control)

Transitions

Lettura/scritturaGets or sets the collection of Transition style elements that apply to a UIElement. (Ereditato da UIElement)

Triggers

Sola letturaGets the collection of triggers for animations that are defined for a FrameworkElement. Not commonly used. (Ereditato da FrameworkElement)

UseLayoutRounding

Lettura/scritturaGets or sets a value that determines whether rendering for the object and its visual subtree should use rounding behavior that aligns rendering to whole pixels. (Ereditato da UIElement)

VerticalAlignment

Lettura/scritturaGets or sets the vertical alignment characteristics that are applied to a FrameworkElement when it is composed in a parent object such as a panel or items control. (Ereditato da FrameworkElement)

VerticalContentAlignment

Lettura/scritturaGets or sets the vertical alignment of the control's content. (Ereditato da Control)

Visibility

Lettura/scritturaGets or sets the visibility of a UIElement. A UIElement that is not visible is not rendered and does not communicate its desired size to layout. (Ereditato da UIElement)

Width

Lettura/scritturaGets or sets the width of a FrameworkElement. (Ereditato da FrameworkElement)

 

Osservazioni

Utilizzare un oggetto ListView per visualizzare una raccolta di dati che scorre verticalmente. Per visualizzare una raccolta che scorre orizzontalmente, utilizzare l'oggetto GridView.

L'oggetto ListView è un oggetto ItemsControl, pertanto può contenere una raccolta di elementi di qualsiasi tipo. Per popolare la visualizzazione, aggiungere elementi alla raccolta Items o impostare la proprietà ItemsSource su un'origine dati.

Per impostazione predefinita, un elemento di dati viene visualizzato nell'oggetto ListView come rappresentazione di stringa dell'oggetto dati a cui è associato. Per specificare esattamente come vengono visualizzati gli elementi nell'oggetto ListView, creare un oggetto DataTemplate per definire il layout dei controlli utilizzati per visualizzare un elemento singolo. I controlli del layout possono essere associati alle proprietà di un oggetto dati oppure il loro contenuto può essere definito inline. L'oggetto DataTemplate viene assegnato alla proprietà ItemTemplate dell'oggetto ListView. Per i modelli comuni che è possibile utilizzare in un'app, vedere Modelli di elementi per layout di elenco.

Nota  

Se si popola l'oggetto ListView impostando la proprietà ItemsSource, l'oggetto ItemTemplate viene applicato a ogni elemento. Se si popola direttamente la raccolta Items, l'oggetto ItemTemplate viene applicato solo se l'elemento non è un oggetto ListViewItem. Per ulteriori informazioni, vedere gli esempi.

Per impostazione predefinita, un utente può selezionare un singolo elemento in un oggetto ListView. È possibile impostare la proprietà SelectionMode su un valore dell'enumerazione ListViewSelectionMode per abilitare la selezione multipla o disabilitare la selezione. È possibile modificare anche la modalità di interazione ListView per fare in modo che gli elementi rispondano al clic di un utente come un pulsante invece di essere selezionati.

In questa tabella vengono visualizzati i modi in cui un utente può interagire con un oggetto ListView e come può rispondere all'interazione.

Per abilitare questa interazione:Utilizzare queste impostazioni:Gestire questo evento:Utilizzare questa proprietà per ottenere l'elemento selezionato:
Nessuna interazione SelectionMode = None, IsItemClickEnabled = FalseN/DN/D
Selezione singola SelectionMode = Single, IsItemClickEnabled = False SelectionChanged SelectedItem, SelectedIndex
Selezione multipla contigua SelectionMode = Multiple, IsItemClickEnabled = False SelectionChanged SelectedItems
Selezione multipla non contigua SelectionMode = Extended, IsItemClickEnabled = False SelectionChanged SelectedItems
Fare clic su SelectionMode = None, IsItemClickEnabled = True ItemClick N/D

 

Attenzione  L'evento PointerWheelChanged non viene propagato da un oggetto ListView. Ciò significa che un controllo con un oggetto ListView al suo interno non riceve messaggi relativi al cambio della rotellina del mouse se il puntatore si trova sull'oggetto ListView. Ad esempio, se si inserisce un oggetto ListView in un oggetto ScrollViewer, non è possibile scorrere l'oggetto ScrollViewer con la rotellina del mouse quando il puntatore si trova sopra l'oggetto ListView.

L'oggetto ListView supporta la virtualizzazione dei dati per migliorare le prestazioni con grandi set di dati. La virtualizzazione di accesso casuale è supportata quando l'origine dati implementa l'interfaccia IObservableVector o INotifyCollectionChanged. La virtualizzazione di caricamento incrementale è supportata quando l'origine dati implementa l'interfaccia ISupportIncrementalLoading. Quando è supportato il caricamento incrementale, è possibile utilizzare questi membri per controllare il caricamento dati: DataFetchSize, IncrementalLoadingThreshold, IncrementalLoadingTrigger, LoadMoreItemsAsync.

L'oggetto ListView implementa l'interfaccia ISemanticZoomInformation, in modo che possa essere utilizzata come visualizzazione in un controllo SemanticZoom. Quando viene utilizzato in un controllo SemanticZoom, impostare sempre la proprietà associata ScrollViewer.IsVerticalScrollChainingEnabled su false nell'oggetto ScrollViewer che si trova nel modello di controllo dell'oggetto ListView, in modo analogo al seguente: <ListView ScrollViewer.IsVerticalScrollChainingEnabled="False">. Questi membri hanno effetto solo quando l'oggetto ListView viene ospitato in un controllo SemanticZoom: IsActiveView, IsZoomedInView, SemanticZoomOwner, CompleteViewChange, CompleteViewChangeFrom, CompleteViewChangeTo, InitializeViewChange, MakeVisible, StartViewChangeFrom, StartViewChangeTo.

Per ulteriori informazioni, vedere questi argomenti:

Per altri esempi di codice che illustrano l'utilizzo del controllo ListView, vedere i seguenti esempi:

Esempi

In questo esempio, l'oggetto ItemTemplate di un oggetto ListView viene definito inline. Poiché l'oggetto ItemsSource è impostato, l'oggetto ItemTemplate viene applicato a ogni elemento.


<ListView x:Name="itemListView"
          Margin="120,0,0,60"
          ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
          SelectionChanged="ItemListView_SelectionChanged">
    <ListView.ItemTemplate>
        <DataTemplate>
            <Grid Height="110" Margin="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="110" Height="110">
                    <Image Source="{Binding Image}" Stretch="UniformToFill"/>
                </Border>
                <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
                    <TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextStyle}" TextWrapping="NoWrap"/>
                    <TextBlock Text="{Binding Subtitle}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/>
                    <TextBlock Text="{Binding Description}" Style="{StaticResource BodyTextStyle}" MaxHeight="60"/>
                </StackPanel>
            </Grid>
        </DataTemplate>
    </ListView.ItemTemplate>          
</ListView>


In questo oggetto ListView l'oggetto ItemTemplate viene applicato al primo elemento (una stringa), ma non al secondo (un oggetto ListViewItem). Per ulteriori informazioni, vedere la sezione Osservazioni.


<ListView>
    <ListView.ItemTemplate>
        <DataTemplate>
            <Grid>
                <Border Background="LightGray" Height="200" Width="200">
                    <TextBlock Text="{Binding}" 
                               FontSize="48" Foreground="Green" />
                </Border>
            </Grid>
        </DataTemplate>
    </ListView.ItemTemplate>
    <ListView.Items>
        <x:String>One</x:String>
        <ListViewItem>Two</ListViewItem>
    </ListView.Items>
</ListView>

Requisiti

Client minimo supportato

Windows 8 [solo app di Windows Store]

Server minimo supportato

Windows Server 2012 [solo app di Windows Store]

Spazio dei nomi

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadati

Windows.winmd

Vedi anche

ListViewBase
ISemanticZoomInformation

 

 

Mostra:
© 2018 Microsoft