Меню Рубрики

Windows phone listview grouping

IanG on Tap

Blog Navigation

Writing

Other Sites

Windows Phone ListView and Grouping

This is the first article a series exploring some of the technical challenges I encountered while writing my Agenda View Windows Phone app. My first topic is multi-level grouping. Surprisingly, doing this well turns out to be sufficiently hard that I’ll be writing four articles on it!

Note that although I’m discussing a phone app, most of the content in these articles is applicable to Windows 8 store apps and Universal apps.

In this first article, I’ll show the ListView control’s built-in grouping features, and explain why they’re not quite sufficient for this app. I’ll also show an alternative approach that enabled multi-level grouping with very little work, but which turned out to have problems when applied to real data. In later articles I’ll explain what I ended up doing instead.

The App’s Grouping Requirements

The app displays appointments grouped by both time and day. If you happen to have conflicting appointments that start at the same time, these will come under a single heading showing that time. And at a wide scale, all of the day’s appointments are grouped under a heading showing either the text TODAY, or the relevant date if the appointment is further out. I’ve annotated a screenshot to show precisely how grouping occurs:

I’ve outlined individual items in red. These are grouped by start time, as shown with the green outlines. And those time groups are in turn grouped by day, shown here with a blue outline. I’ve also shown the same hierarchy in a sort of treeview-like structure to the side.

Most items have a distinct start time—people usually try to avoid scheduling multiple simultaneous appointments, so you’d normally expect each time group to contain exactly one item. But sometimes collisions occur, and in this case, you can see I’ve got two items in the time group for 6:30pm near the top. That’s why I need an additional level of grouping within the day groups.

This logical structure was non-negotiable, because this is how the Calendar app used to show things (up until the Windows Phone 8.1 update removed the agenda view) and the entire point of my app was to provide something as close as possible to the original feature. However, this turns out not to be totally straightforward, because the ListView control available in store apps does not support multi-level grouping. (I can only assume that the original Calendar app didn’t use XAML.)

ListView’s Built-In Grouping

All of Microsoft’s XAML frameworks support grouping, but the way this works has changed with the introduction of WinRT (or ‘store apps’ to use Microsoft’s current name for apps that use this API), first for Windows 8, and now for Windows Phone 8.1. With all the other versions of XAML, you would enable grouping with something like this:

In pre-WinRT XAML, your data source supplied a flat list of items, and you asked the CollectionViewSource to gather it into groups for you, according to one or more grouping criteria. The example above states that items should be grouped by the value of their Country property, and then within each country group, items should be grouped by the value of a Town property. (By the way, the Windows Phone version of Silverlight doesn’t support this properly. It accepts the XAML above, but it appears to ignore everything after the first level.)

But if you use WinRT (because either you’re writing a Universal app that targets both tablets and phones, or you’re writing a Windows 8 store app, or you’re writing a phone-only app and have chosen to use the ‘store app’ template instead of the Silverlight one) things are different. Data binding will not group the data for you. You must supply it with a collection of collections, e.g.:

If you have a flat list, you can build the groups easily enough:

Next, you need a CollectionViewSource with grouping enabled:

You can then supply that with your group list, either in code behind:

or you could hook it up with data binding. Either way, the goal is to supply a collection of collections to the Source property of a CollectionViewSource in which IsSourceGrouped is true.

With this in place, you can now use it in a ListView , and you provide a group style to determine how the group headings should appear:

Running the app shows the data grouped by country, using the group header template to display the country name at the top of the group:

That group header is ‘sticky’ in that it stays put at the top of the list as you scroll through the group:

As you scroll into the next group, its header slides into place, pushing the header of the previous group out of the way. Here’s that transition in action, half way through:

That’s all very well, but there’s an obvious problem with my example: within each group, I have several items all with the same town or city name. I’d like to group those too.

We could try adding a second group class, and modifying the top-level one:

The code to group a flat list of items is now a little more complex, thanks to having two levels, but it’s still the same idea:

But how do we present these nested groups? A glance at the ListView control’s GroupStyle property provides hope:

As with longer-established XAML frameworks like WPF, the GroupStyle property is a collection. So you’d think we can provide a style for each grouping level, just like we would in WPF. Here’s a ListView with two group styles, and a correspondingly simpler item template:

Sadly, this doesn’t work. Here’s the result:

That’s not quite what we wanted.

It turns out that the ListView is just ignoring the second group style. It’s only grouping to a single level, and it is treating those TownGroup objects as the list items. The TownGroup has no Address property, which is why the item template displays nothing. If I modify the item template to bind to Town (a property that is available on TownGroup ) instead of Address , I see this:

The effect is that I’ve got a list of towns grouped by country—just a single level of grouping. The ListView is oblivious to the individual items within each country group.

The bottom line is that ListView does not support groups of groups of items.

Lists within Lists

Anyone with much XAML experience will probably think of an obvious solution at this point: if the item template is being given the nested group, why not just make that expand the children? We can go back to having a single group style (because ListView will ignore all but the first) and then in our item template (which, remember, is now being passed the nested TownGroup objects), we show the Town property as the group title, and then an ItemsControl to show all the items in the group:

At first glance, this appears to work:

That certainly looks like what I wanted: everything is grouped by country, and within each country the items are grouped by town, and I’ve been able to define a different style for the two group levels’ headings.

So what’s the problem?

Well the first obvious issue (for my app, at any rate) is that the individual items are no longer tappable—as far as this ListView is concerned, each item in the list is the whole town group. I tried replacing the ItemsControl in the item template with a nested ListView as a quick fix, but that just seemed to slow things down drastically. When I do that, the app has trouble keeping up with even fairly pedestrian scrolling on the phone I use for development. (A Nokia Lumia 620.) However, while this hack didn’t work, I expect it’s possible to make individual items tappable with suitable changes to the item template.

But there’s another problem: it turns out that whether you nest a ListView or an ItemsControl this solution doesn’t work well once you start using anything more than about one and a half screen’s worth of data. (This means that if, like me, you build a prototype to test whether your approach is viable, it all looks like it’s working beautifully until you plug in some real data, and only then do you discover that you’ve gone down a blind alley. I hope that this series of articles will save you from that fate.)

The problems really only become apparent when you start scrolling back up through the list having scrolled down through it. The content starts jumping around on the screen, and sometimes the entire list goes blank for a few seconds before reappearing.

If you want to see the issues yourself, you can grab the app from here. Run it on a real phone, and scroll a long way down through the data, and then back up again reasonably quickly. You’ll see pretty quickly that this is not a usable solution.

As far as I can tell, the fundamental problem is that virtualization does not mix well with variable item heights. (Switching virtualization off is not a realistic option for my app, by the way.) There’s a subtle but critical difference between the item template in the last XAML snippet, and the one in the first ListView snippet in this blog entry. Here’s the important bit from the first one:

And here’s the corresponding piece of the one that didn’t work well:

The key is that the first example has a fixed height, but the second one doesn’t. It can’t, because that the second one contains an ItemsControl whose height will depend on the number of items in the group—the nature of that example is that each item (and remember, an ‘item’ in that example is actually group of addresses all in the same town) will need to determine its own height based on the number of items it contains.

In classic XAML terminology, the first item template has a constrained height, while the second sizes to content.

Variable item height has always been a problem for virtualized lists in XAML. (If you happen to have a Pluralsight subscription, take a look at the Templates module of my WPF and XAML Fundamentals course. If you watch the “ItemsControl Options” clip (12th clip in the module), starting at about 4:45 you get to see a WPF ListView going slightly haywire as a result of highly variable item sizes in a virtualized list.) And this in turn has meant that grouping has always been a tricky case, because groups almost always vary in height. So in a lot of scenarios, grouping in XAML just disables virtualization.

Variable item height seems to cause particularly visually distracting problems for the WinRT ListView . As far as I’ve been able to tell in discussions with people from Microsoft, the problems occur when it starts recycling containers that have scrolled off the screen—if those change size significantly when given new data, this appears to mess with the layout of the items that are still on the screen, causing the entire list to jump around in a rather disturbing way.

This turns out to be one of the main reasons for getting the ListView to help us with grouping in the first place. You can use that ItemsControl -in-item-template trick to handle any number of levels of grouping, including a single level, and if the trick actually worked properly, we wouldn’t really need ListView to provide built-in support for groups at all. (About the only thing it would really be doing for us is the neat ‘sticky’ group headers that slide into place as you scroll.) But because it’s pretty rare for each of the groups in a grouped list to have the same size, the trick does not in fact work. The virtualization mechanism goes a bit crazy trying to deal with the variation in sizes, and the result is that the app appears to be having a fit.

So in practice, the biggest benefit of using the built-in group support in the ListView is that it takes care of interleaving group headings for you in a way that the control’s underlying virtualizing panel can cope with, meaning that everything scrolls around nice and smoothly. As soon as you try to handle this yourself, it all seems to break down.

Conclusion

If you want just one level of grouping, the built-in support provided by ListView is excellent. But if you want groups of groups, it cannot help you. In the end, I needed to use a radically different approach to solve this problem, which I’ll describe in the next article in this series.

Источник

List View Class

Definition

Represents a control that displays data items in a vertical stack.

Windows 10 requirements

Examples

For more info, design guidance, and code examples, see List view and grid view.

If you have the XAML Controls Gallery app installed, click here to open the app and see the ListView in action.

In this example, the ItemTemplate of a ListView is defined inline. Because the ItemsSource is set, the ItemTemplate is applied to every item.

Remarks

For more info, design guidance, and code examples, see List view and grid view.

Use a ListView to display a collection of items stacked vertically or horizontally. To display a collection in rows and columns, use a GridView.

ListView is an ItemsControl, so it can contain a collection of items of any type. To populate the view, add items to the Items collection, or set the ItemsSource property to a data source.

By default, a data item is displayed in the ListView as the string representation of the data object it’s bound to. To specify exactly how items in the ListView are displayed, you create a DataTemplate to define the layout of controls used to display an individual item. The controls in the layout can be bound to properties of a data object, or have content defined inline. You assign the DataTemplate to the ItemTemplate property of the ListView. For common templates you can use in your app, see Item templates for ListView.

If you populate the ListView by setting the ItemsSource property, the ItemTemplate is applied to every item. If you populate the Items collection directly, the ItemTemplate is applied only if the item is not a ListViewItem. See Examples for more info.

If you use the ListView to display large sets of data, see Optimize ListView and GridView for tips to maintain a smooth and responsive user experience.

By default, instead of performing selection, an active pen now scrolls/pans a list in UWP apps (like touch, touchpad, and passive pen). If your app depends on the previous behavior, you can override pen scrolling and revert to the previous behavior. See the ScrollViewer class reference for details.

By default, a user can select a single item in a ListView. You can set the SelectionMode property to a ListViewSelectionMode enumeration value to allow multi-selection or to disable selection. You can also change the ListView interaction mode to make items respond to a user click like a button instead of being selected.

This table shows the ways a user can interact with a ListView, and how you can respond to the interaction.

To enable this interaction: Use these settings: Handle this event: Use this property to get the selected item:
No interaction SelectionMode = None, IsItemClickEnabled = False N/A N/A
Single selection SelectionMode = Single, IsItemClickEnabled = False SelectionChanged SelectedItem, SelectedIndex
Contiguous multi-selection SelectionMode = Multiple, IsItemClickEnabled = False SelectionChanged SelectedItems
Non-contiguous multi-selection SelectionMode = Extended, IsItemClickEnabled = False SelectionChanged SelectedItems
Click SelectionMode = None, IsItemClickEnabled = True ItemClick N/A

The PointerWheelChanged event does not bubble up from a ListView. This means that a control that has a ListView inside of it does not receive mouse wheel change messages if the pointer is over the ListView. For example, if you put a ListView inside of a ScrollViewer, you can’t scroll the ScrollViewer with the mouse wheel when the pointer is over the ListView.

ListView supports data virtualization to improve performance with large data sets. Random access virtualization is supported when the data source implements the appropriate interfaces, which vary depending on the programming language:

  • VisualВ C++ component extensions (C++/CX) apps should implement IObservableVector.
  • C# or Visual Basic apps should implement INotifyCollectionChanged and System.Collections.IList (not IList ). Virtualization requires both of these interfaces. Incremental loading virtualization is supported when the data source implements the ISupportIncrementalLoading interface. When incremental loading is supported, you can use these members to control data loading: DataFetchSize, IncrementalLoadingThreshold, IncrementalLoadingTrigger, LoadMoreItemsAsync.

WindowsВ 8 In WindowsВ 8, when the data item in a selected ListViewItem is replaced, the SelectedIndex value is not cleared. In WindowsВ 8.1 or later, the SelectedIndex value is cleared.

ListView implements the ISemanticZoomInformation interface, so it can be used as a view in a SemanticZoom control. When it’s used in a SemanticZoom control, always set the ScrollViewer.IsVerticalScrollChainingEnabled attached property to false on the ScrollViewer that’s in the ListView’s control template, like this:
. These members have an effect only when the ListView is hosted in a SemanticZoom control: IsActiveView, IsZoomedInView, SemanticZoomOwner, CompleteViewChange, CompleteViewChangeFrom, CompleteViewChangeTo, InitializeViewChange, MakeVisible, StartViewChangeFrom, StartViewChangeTo.

Selection behavior and CollectionViewSource

List controls that derive from Selector have a default selection behavior that depends on what the items source is (the type that’s used for ItemsSource ). If the items source is a CollectionViewSource instance, then the behavior in the selection control is that the selection will default to the current item. When the list is first displayed, the selection defaults to the first item as current item. If you don’t want the first item to be selected in this case, set IsSynchronizedWithCurrentItem to false in the ListView.

Constructors

Initializes a new instance of the ListView class.

Properties

Gets or sets the access key (mnemonic) for this element.

Gets or sets a source element that provides the access key scope for this element, even if it’s not in the visual tree of the source element.

Gets the rendered height of a FrameworkElement. See Remarks.

Gets the position of this UIElement, relative to its parent, computed during the arrange pass of the layout process.

Gets the size that this UIElement computed during the arrange pass of the layout process.

Gets the UI theme that is currently used by the element, which might be different than the RequestedTheme.

Gets the rendered width of a FrameworkElement. See Remarks.

Gets or sets a value that determines whether this UIElement can be a drop target for purposes of drag-and-drop operations.

Gets or sets a value that indicates whether the element automatically gets focus when the user interacts with it.

Gets or sets whether a disabled control can receive focus.

Gets or sets a brush that provides the background of the control.

Gets or sets a value that indicates how far the background extends in relation to this element’s border.

Gets 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.

Gets or sets a brush that describes the border fill of a control.

Gets or sets the border thickness of a control.

Gets or sets a value that indicates that rendered content should be cached as a composited bitmap when possible.

Gets or sets a value that indicates whether the UIElement can be a candidate for scroll anchoring.

Gets or sets a value that indicates whether the element can be dragged as data in a drag-and-drop operation.

Gets or sets a value that indicates whether items in the view can be dragged as data payload.

Gets or sets a value that indicates whether items in the view can be reordered through user interaction.

Gets or sets the center point of the element, which is the point about which rotation or scaling occurs. Affects the rendering position of the element.

Gets or sets the uniform spacing between characters, in units of 1/1000 of an em.

Gets or sets the RectangleGeometry used to define the outline of the contents of a UIElement.

Gets or sets a property that declares alternate composition and blending modes for the element in its parent layout and window. This is relevant for elements that are involved in a mixed XAML / Microsoft DirectX UI.

Gets or sets the flyout associated with this element.

Gets or sets the radius for the corners of the control’s border.

Gets or sets the data context for a FrameworkElement. A common use of a data context is when a FrameworkElement uses the markup extension and participates in data binding.

Gets or sets the amount of data to fetch for virtualizing/prefetch operations.

Gets or sets the key that references the default style for the control. Authors of custom controls use this property to change the default for the style that their control uses.

Gets or sets the path to the resource file that contains the default style for the control.

Gets the size that this UIElement computed during the measure pass of the layout process.

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

Gets or sets the name or path of the property that is displayed for each data item.

Get or sets a value that specifies a control’s preference for whether sounds are played.

Gets or sets a value that specifies whether the access key display is dismissed when an access key is invoked.

Gets 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.

Gets a value that specifies whether this control has focus, and the mode by which focus was obtained.

Gets or sets the outer margin of the focus visual for a FrameworkElement.

Gets or sets the brush used to draw the outer border of a HighVisibility or Reveal focus visual for a FrameworkElement.

Gets or sets the thickness of the outer border of a HighVisibility or Reveal focus visual for a FrameworkElement.

Gets or sets the brush used to draw the inner border of a HighVisibility or Reveal focus visual for a FrameworkElement.

Gets or sets the thickness of the inner border of a HighVisibility or Reveal focus visual for a FrameworkElement.

Gets or sets the font used to display text in the control.

Gets or sets the size of the text in this control.

Gets or sets the degree to which a font is condensed or expanded on the screen.

Gets or sets the style in which the text is rendered.

Gets or sets the thickness of the specified font.

Gets or sets the content for the list footer.

Gets or sets the DataTemplate used to display the content of the view footer.

Gets or sets the collection of Transition style elements that apply to the view footer.

Gets or sets a brush that describes the foreground color.

Gets a collection of GroupStyle objects that define the appearance of each level of groups.

Gets 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.

Gets or sets the content for the list header.

Gets or sets the DataTemplate used to display the content of the view header.

Gets or sets the collection of Transition style elements that apply to the view header.

Gets or sets the suggested height of a FrameworkElement.

Gets or sets a value that indicates whether the framework automatically adjusts the element’s visual properties when high contrast themes are enabled.

Gets 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.

Gets or sets the horizontal alignment of the control’s content.

Gets or sets the threshold range that governs when the ListViewBase class will begin to prefetch more items.

Gets or sets a value that indicates the conditions for prefetch operations by the ListViewBase class.

Gets or sets a value that indicates whether an element defines its own access key scope.

Gets or sets a value that indicates whether the ListViewBase instance is the active view in its owning SemanticZoom.

Gets or sets a value that determines whether the DoubleTapped event can originate from that element.

Gets or sets a value indicating whether the user can interact with the control.

Get or sets a value that indicates whether focus is constrained within the control boundaries (for game pad/remote interaction).

Get or sets a value that indicates whether focus can be constrained within the control boundaries (for game pad/remote interaction).

Gets a value that indicates whether the control is using grouping.

Gets or sets whether the contained area of this UIElement can return true values for hit testing.

Gets or sets a value that determines whether the Holding event can originate from that element.

Gets or sets a value that indicates whether items in the view fire an ItemClick event in response to interaction.

Gets a value that indicates whether the element has been added to the element tree and is ready for interaction.

Gets or sets a value that indicates whether a check box is shown to enable multi-selection.

Gets or sets a value that determines whether the RightTapped event can originate from that element.

Gets or sets a value that indicates whether the view supports discrete input processing for a swipe interaction.

Gets or sets a value that indicates whether a Selector should keep the SelectedItem synchronized with the current item in the Items property.

Gets or sets a value that indicates whether a control is included in tab navigation.

Gets or sets a value that determines whether the Tapped event can originate from that element.

Gets or sets whether automatic text enlargement, to reflect the system text size setting, is enabled.

Gets or sets a value that indicates whether the ListViewBase instance is the zoomed-in view in its owning SemanticZoom.

Gets or sets the style that is used when rendering the item containers for an ItemsControl.

Gets 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.

Gets or sets the collection of Transition style elements that apply to the item containers of an ItemsControl.

Gets the collection used to generate the content of the control.

Gets or sets the template that defines the panel that controls the layout of items.

Gets the Panel specified by ItemsPanel.

Gets or sets an object source used to generate the content of the ItemsControl.

Gets or sets the DataTemplate used to display each item.

Gets or sets a reference to a custom DataTemplateSelector logic class. The DataTemplateSelector referenced by this property returns a template to apply to items.

Gets or sets a value that indicates whether the control tooltip displays the key combination for it’s associated keyboard accelerator.

Gets or sets a value that indicates the control tooltip that displays the accelerator key combination.

Gets the collection of key combinations that invoke an action using the keyboard.

Accelerators are typically assigned to buttons or menu items.


Example of a menu showing keyboard accelerators for various menu items

Gets or sets a value that indicates how far left or right the Key Tip is placed in relation to the UIElement.

Gets or sets a value that indicates where the access key Key Tip is placed in relation to the boundary of the UIElement.

Gets or sets a value that indicates the element targeted by the access key Key Tip.

Gets or sets a value that indicates how far up or down the Key Tip is placed in relation to the UI element.

Gets 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.

Gets the collection of XamlLight objects attached to this element.

Gets or sets the ManipulationModes value used for UIElement behavior and interaction with gestures. Setting this value enables handling the manipulation events from this element in app code.

Gets or sets the outer margin of a FrameworkElement.

Gets or sets the maximum height constraint of a FrameworkElement.

Gets or sets the maximum width constraint of a FrameworkElement.

Gets or sets the minimum height constraint of a FrameworkElement.

Gets or sets the minimum width constraint of a FrameworkElement.

Gets 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.

Gets or sets the degree of the object’s opacity.

Gets or sets the ScalarTransition that animates changes to the Opacity property.

Gets or sets the padding inside a control.

Gets the parent object of this FrameworkElement in the object tree.

Gets the set of all captured pointers, represented as Pointer values.

Gets or sets the perspective projection (3-D effect) to apply when rendering this element.

Gets the final render size of a UIElement. Use is not recommended, see Remarks.

Gets or sets transform information that affects the rendering position of a UIElement.

Gets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement.

Gets or sets the reorder behavior for a ListViewBase instance. When Enabled, unsorted and ungrouped lists can be reordered by user manipulation.

Gets or sets the UI theme that is used by the UIElement (and its child elements) for resource determination. The UI theme you specify with RequestedTheme can override the app-level RequestedTheme.

Gets or sets whether a UI element supports mouse mode, which emulates pointer interaction experiences with non-pointer input devices such as an Xbox gamepad or remote control.

Gets 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.

Gets or sets the angle of clockwise rotation, in degrees. Rotates relative to the RotationAxis and the CenterPoint. Affects the rendering position of the element.

Gets or sets the axis to rotate the element around.

Gets or sets the ScalarTransition that animates changes to the Rotation property.

Gets or sets the scale of the element. Scales relative to the element’s CenterPoint. Affects the rendering position of the element.

Gets or sets the Vector3Transition that animates changes to the Scale property.

Gets or sets the index of the selected item.

Gets or sets the selected item.

Gets the currently selected items.

Gets a collection of ItemIndexRange objects that describe the currently selected items in the list.

Gets or sets the value of the selected item, obtained by using the SelectedValuePath.

Gets or sets the property path that is used to get the SelectedValue property of the SelectedItem property.

Gets or sets the selection behavior for a ListViewBase instance.

Gets or sets the SemanticZoom instance that hosts the ListViewBase.

Gets or sets the shadow effect cast by the element.

Gets or sets a value that indicates whether the view shows placeholder UI for items during scrolling.

Gets or sets a value that indicates whether item selection changes when keyboard focus changes.

Gets or sets an instance Style that is applied for this object during layout and rendering.

Gets or sets a value that modifies how tabbing and TabIndex work for this control.

Gets or sets a value that determines the order in which elements receive focus when the user navigates through controls by pressing the Tab key.

Gets or sets a value that modifies how tabbing and TabIndex work for this control.

For Windows 10 Creators Update (build 10.0.15063) and newer, the TabFocusNavigation property is available on the UIElement base class to include objects in the tab sequence that do not use a ControlTemplate.

Gets or sets an arbitrary object value that can be used to store custom information about this object.

Gets or sets a control template. The control template defines the visual appearance of a control in UI, and is defined in XAML markup.

Gets or sets the 3-D transform effect to apply when rendering this element.

Gets or sets the transformation matrix to apply to the element.

Gets or sets the collection of Transition style elements that apply to a UIElement.

Gets or sets the x, y, and z rendering position of the element.

Gets or sets the Vector3Transition that animates changes to the Translation property.

Gets the collection of triggers for animations that are defined for a FrameworkElement. Not commonly used. See Remarks.

Gets the context identifier for the element.

Gets 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.

Gets or sets a value that indicates whether the control uses focus visuals that are drawn by the system or those defined in the control template.

Gets 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.

Gets or sets the vertical alignment of the control’s content.

Gets 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.

Gets or sets the width of a FrameworkElement.

Gets or sets the XamlRoot in which this element is being viewed.

Gets or sets the object that gets focus when a user presses the Directional Pad (D-pad) down.

Gets or sets a value that specifies the strategy used to determine the target element of a down navigation.

Gets or sets a value that enables or disables navigation using the keyboard directional arrows.

Gets or sets the object that gets focus when a user presses the Directional Pad (D-pad) left.

Gets or sets a value that specifies the strategy used to determine the target element of a left navigation.

Gets or sets the object that gets focus when a user presses the Directional Pad (D-pad) right.

Gets or sets a value that specifies the strategy used to determine the target element of a right navigation.

Gets or sets the object that gets focus when a user presses the Directional Pad (D-pad) up.

Gets or sets a value that specifies the strategy used to determine the target element of an up navigation.

Methods

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.

Loads the relevant control template so that its parts can be referenced.

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.

Provides the behavior for the «Arrange» pass of layout. Classes can override this method to define their own «Arrange» pass behavior.

Cancels ongoing direct manipulation processing (system-defined panning/zooming) on any ScrollViewer parent that contains the current UIElement.

Sets pointer capture to a UIElement. Once captured, only the element that has capture will fire pointer-related events.

Undoes the effects of the PrepareContainerForItemOverride method.

Clears the local value of a dependency property.

Changes related aspects of presentation when the overall view for a SemanticZoom changes.

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.

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.

Returns the container for the item at the specified index within the ItemCollection.

Returns the container corresponding to the specified item.

Deselects a block of items described by the ItemIndexRange.

Retrieves an object that has the specified identifier name.

Enables a UIElement subclass to expose child elements that assist with resolving touch targeting.

Attempts to set the focus on the control.

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

Returns the BindingExpression that represents the binding on the specified property.

Enables a UIElement subclass to expose child elements that take part in Tab focus.

Creates or identifies the element that is used to display the given item.

Retrieves the named element in the instantiated ControlTemplate visual tree.

Returns the current effective value of a dependency property from a DependencyObject.

When implemented in a derived class, enables per-state construction of a visual tree for a control template in code, rather than by loading XAML for all states at control startup.

Returns the group header container that corresponds to the specified container element.

Returns the index to the item that has the specified, generated container.

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.

Invalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously.

Invalidates the measurement state (layout) for a UIElement.

Invalidates the viewport state for a UIElement that is used to calculate the effective viewport.

Returns a value that indicates whether the list view is both the drag source and drop target in a drag-and-drop operation.

Determines whether the specified item is (or is eligible to be) its own container.

Returns the item that corresponds to the specified, generated container.

Initiates the asynchronous request to load more data items, in accordance with the active incremental loading settings.

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.

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.

Provides the behavior for the «Measure» pass of the layout cycle. Classes can override this method to define their own «Measure» pass behavior.

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.

Called before the BringIntoViewRequested event occurs.

Called before the CharacterReceived event occurs.

When implemented in a derived class, returns class-specific AutomationPeer implementations for the Microsoft UI Automation infrastructure.

Override this method to implement how layout and logic should behave when items are removed from a class-specific content or children property.

Called before the DoubleTapped event occurs.

Called before the DragEnter event occurs.

Called before the DragLeave event occurs.

Called before the DragOver event occurs.

Called before the Drop event occurs.

Called before the GotFocus event occurs.

Invoked when the value of the GroupStyleSelector property changes.

Called before the Holding event occurs.

Invoked when the value of the ItemContainerStyle property changes.

Invoked when the value of the ItemContainerStyleSelector property changes.

Invoked when the value of the Items property changes.

Invoked when the value of the ItemTemplate property changes.

Invoked when the value of the ItemTemplateSelector property changes.

Called when a keyboard shortcut (or accelerator) is processed in your app. Override this method to handle how your app responds when a keyboard accelerator is invoked.

Called before the KeyDown event occurs.

Called before the KeyUp event occurs.

Called before the LostFocus event occurs.

Called before the ManipulationCompleted event occurs.

Called before the ManipulationDelta event occurs.

Called before the ManipulationInertiaStarting event occurs.

Called before the ManipulationStarted event occurs.

Called before the ManipulationStarting event occurs.

Called before the PointerCanceled event occurs.

Called before the PointerCaptureLost event occurs.

Called before the PointerEntered event occurs.

Called before the PointerExited event occurs.

Called before the PointerMoved event occurs.

Called before the PointerPressed event occurs.

Called before the PointerReleased event occurs.

Called before the PointerWheelChanged event occurs.

Called before the PreviewKeyDown event occurs.

Called before the PreviewKeyUp event occurs.

Called just before a keyboard shortcut (or accelerator) is processed in your app. Invoked whenever application code or internal processes call ProcessKeyboardAccelerators. Override this method to influence the default accelerator handling.

Called before the RightTapped event occurs.

Called before the Tapped event occurs.

Defines a property that can be animated.

When overridden in a derived class, defines a property that can be animated.

Returns a connected animation that’s associated with the specified key, data item, and source element.

Prepares the specified element to display the specified item.

Returns the local value of a dependency property, if a local value is set.

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

Releases pointer captures for capture of one specific pointer by this UIElement.

Releases all pointer captures held by this element.

Releases focus from the control boundaries for a control that has focus engagement (for game pad/remote interaction).

Removes the specified routed event handler from this UIElement. Typically the handler in question was added by AddHandler.

Scrolls the list to bring the specified data item into view.

Scrolls the list to bring the specified data item into view with the specified alignment.

Selects all the items in a view.

Selects a block of items described by the ItemIndexRange.

Attaches a binding to a FrameworkElement, using the provided binding object.

Sets the maximum target time between two render passes when a ListViewBase is updating its UI with data items during initial load or scrolling.

Sets the local value of a dependency property on a DependencyObject.

Begins the specified animation on the element.

Initiates a request to the XAML framework to bring the element into view within any scrollable regions it is contained within.

Initiates a request to the XAML framework to bring the element into view using the specified options.

Initiates a drag-and-drop operation.

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.

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.

Stops the specified animation on the element.

Returns a transform object that can be used to transform coordinates from the UIElement to the specified object.

Attempts to invoke a keyboard shortcut (or accelerator) by searching the entire visual tree of the UIElement for the shortcut.

Attempts to start the animation.

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

Ensures that all positions of child objects of a UIElement are properly updated for layout.

Events

Occurs when access keys should no longer be displayed.

Occurs when the user requests that access keys be displayed.

Occurs when a user completes an access key sequence.

Occurs when the ActualTheme property value has changed.

Occurs when StartBringIntoView is called on this element or one of its descendants.

Occurs when a single, composed character is received by the input queue.

Occurs when an item container is to be chosen for a data group.

Occurs when an item container is to be chosen for a data item.

Occurs when the data item associated with a UI container changes.

Occurs when a context input gesture continues into a manipulation gesture, to notify the element that the context flyout should not be opened.

Occurs when the user has completed a context input gesture, such as a right-click.

Occurs when the value of the FrameworkElement.DataContext property changes.

Occurs when an otherwise unhandled DoubleTap interaction occurs over the hit test area of this element.

Occurs when the input system reports an underlying drag event with this element as the target.

Occurs when a drag operation that involves one of the items in the view is ended. In order to receive this event, set the CanDragItems property to True.

Occurs when a drag operation that involves one of the items in the view is initiated.

Occurs when the input system reports an underlying drag event with this element as the origin.

Occurs when the input system reports an underlying drag event with this element as the potential drop target.

Occurs when a drag operation is initiated.

Occurs when the input system reports an underlying drop event with this element as the drop target.

Occurs when a drag-and-drop operation with this element as the source is ended.

Occurs when the FrameworkElement ‘s effective viewport changes.

Occurs when focus is released from the control boundaries (for game pad/remote interaction).

Occurs when focus is constrained within the control boundaries (for game pad/remote interaction).

Occurs before a UIElement receives focus. This event is raised synchronously to ensure focus isn’t moved while the event is bubbling.

Occurs when a UIElement receives focus. This event is raised asynchronously, so focus can move again before bubbling is complete.

Occurs when an otherwise unhandled Hold interaction occurs over the hit test area of this element.

Occurs when the IsEnabled property changes.

Occurs when an item in the list view receives an interaction, and the IsItemClickEnabled property is true.

Occurs when a keyboard key is pressed while the UIElement has focus.

Occurs when a keyboard key is released while the UIElement has focus.

Occurs when the layout of the visual tree changes, due to layout-relevant properties changing value or some other action that refreshes the layout.

Occurs when a FrameworkElement has been constructed and added to the object tree, and is ready for interaction.

Occurs when a FrameworkElement begins to load.

Occurs before a UIElement loses focus. This event is raised synchronously to ensure focus isn’t moved while the event is bubbling.

Occurs when a UIElement loses focus. This event is raised asynchronously, so focus can move again before bubbling is complete.

Occurs when a manipulation on the UIElement is complete.

Occurs when the input device changes position during a manipulation.

Occurs when the input device loses contact with the UIElement object during a manipulation and inertia begins.

Occurs when an input device begins a manipulation on the UIElement.

Occurs when the manipulation processor is first created.

Occurs when a user attempts to move focus (via tab or directional arrows), but focus doesn’t move because no focus candidate is found in the direction of movement.

Occurs when a pointer that made contact abnormally loses contact.

Occurs when pointer capture previously held by this element moves to another element or elsewhere.

Occurs when a pointer enters the hit test area of this element.

Occurs when a pointer leaves the hit test area of this element.

Occurs when a pointer moves while the pointer remains within the hit test area of this element.

Occurs when the pointer device initiates a Press action within this element.

Occurs when the pointer device that previously initiated a Press action is released, while within this element. Note that the end of a Press action is not guaranteed to fire a PointerReleased event; other events may fire instead. For more info, see Remarks.

Occurs when the delta value of a pointer wheel changes.

Occurs when a keyboard key is pressed while the UIElement has focus.

Occurs when a keyboard key is released while the UIElement has focus.

Occurs when a right-tap input stimulus happens while the pointer is over the element.

Occurs when the currently selected item changes.

Occurs when either the ActualHeight or the ActualWidth property changes value on a FrameworkElement.

Occurs when an otherwise unhandled Tap interaction occurs over the hit test area of this element.

Occurs when this object is no longer connected to the main object tree.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Windows phone kits что это
  • Windows phone king of thieves
  • Windows phone just dance now
  • Windows phone just dance controller на
  • Windows phone htc 8s a620e