Difference between ListView and ListBox in Visual Studio

試著忘記壹切 提交于 2019-12-29 05:45:48

问题


What is the difference between "ListView" and "ListBox" in a "Windows 8" app.


回答1:


The ListBox is an older control primarily for compatibility with other xaml frameworks. The ListView has build-in functionality for touch etc. Use the ListView unless you have a specific need for the ListBox

See here for more detail.

Specific events available only for ListView:

DragItemsStarting

ItemClick

Methods:

CompleteViewChange

CompeteViewChangeFrom

CompleteViewChangeTo

InitializeViewChange

LoadMoreItemsAsync

MakeVisible

ScrollIntoView(Object, ScrollIntoViewAlignment)

StartViewChangeFrom

StartViewChangeTo

Properties:

CanDragItems

CanDragItemsProperty

CanReorderItems

CanReorderItemsProperty

DataFetchSize

DataFetchSizeProperty

Header

HeaderProperty

HeadTemplate

HeaderTemplateProperty

HeadTransitions

HeadTransitionsProperty

IncrementalLoadingThreshold

IncrementalLoadingThresholdProperty

IncrementalLoadingTrigger

IncrementalLoadingTriggerProperty

IsActiveView

IsActiveViewProperty

IsItemClickEnabled

IsItemClickEnabledProperty

IsSwipeEnabled

IsSwipeEnabledProperty

IsZoomedInView

IsZoomedInViewProperty




回答2:


ListBox is NOT obsolete.

ListBox has many similarities with ListView or GridView (they share the parent class ItemsControl), but each control is oriented towards different scenarios. ListBox is best for general UI composition, particularly when the elements are always intended to be selectable, whereas ListView or GridView are best for data binding scenarios, particularly if virtualization or large data sets are involved.

Source: https://msdn.microsoft.com/library/windows/apps/br242868



来源:https://stackoverflow.com/questions/13879720/difference-between-listview-and-listbox-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!