Page Class

Encapsule une page de contenu pouvant être parcourue.

Héritage

Object
  DependencyObject
    UIElement
      FrameworkElement
        Control
          UserControl
            Page

Syntaxe


public class Page : UserControl


<Page .../>
-or-
<Page ...>
  singleRootElement
</Page>

XAML Values

singleRootElement

Un élément objet unique XAML qui contient le contenu de la page prévu ci-dessous dans sa propre composition en XAML. Il s'agit en général d'un contrôle de panneau ou d'éléments.

Attributs

MarshalingBehaviorAttribute(Agile)
StaticAttribute(Windows.UI.Xaml.Controls.IPageStatics, NTDDI_WIN8)
ThreadingAttribute(Both)
VersionAttribute(NTDDI_WIN8)
WebHostHiddenAttribute()

Membres

PageClasse comporte les types de membres suivants :

Constructeurs

PageClasse comporte les constructeurs suivants.

ConstructeurDescription
Page Initializes a new instance of the Page class.

 

Événements

PageClasse comporte les événements suivants.

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

 

Méthodes

The Page Classe comporte les méthodes suivantes. Il hérite également des méthodes de Object Classe.

MéthodeDescription
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. (Hérité de UIElement)
ApplyTemplate Loads the relevant control template so that its parts can be referenced. (Hérité de 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. (Hérité de UIElement)
ArrangeOverride Provides the behavior for the Arrange pass of layout. Classes can override this method to define their own Arrange pass behavior. (Hérité de FrameworkElement)
CapturePointer Sets pointer capture to a UIElement. Once captured, only the element that has capture will fire pointer-related events. (Hérité de UIElement)
ClearValue Clears the local value of a dependency property. (Hérité de DependencyObject)
FindName Retrieves an object that has the specified identifier name. (Hérité de FrameworkElement)
FindSubElementsForTouchTargeting Enables a UIElement subclass to expose child elements that assist with resolving touch targeting. (Hérité de UIElement)
Focus Attempts to set the focus on the control. (Hérité de Control)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Hérité de DependencyObject)
GetTemplateChild Retrieves the named element in the instantiated ControlTemplate visual tree. (Hérité de Control)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Hérité de DependencyObject)
InvalidateArrange Invalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously. (Hérité de UIElement)
InvalidateMeasure Invalidates the measurement state (layout) for a UIElement. (Hérité de UIElement)
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. (Hérité de 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. (Hérité de 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. (Hérité de FrameworkElement)
OnCreateAutomationPeer When implemented in a derived class, returns class-specific AutomationPeer implementations for the Microsoft UI Automation infrastructure. (Hérité de 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. (Hérité de UIElement)
OnDoubleTapped Called before the DoubleTapped event occurs. (Hérité de Control)
OnDragEnter Called before the DragEnter event occurs. (Hérité de Control)
OnDragLeave Called before the DragLeave event occurs. (Hérité de Control)
OnDragOver Called before the DragOver event occurs. (Hérité de Control)
OnDrop Called before the Drop event occurs. (Hérité de Control)
OnGotFocus Called before the GotFocus event occurs. (Hérité de Control)
OnHolding Called before the Holding event occurs. (Hérité de Control)
OnKeyDown Called before the KeyDown event occurs. (Hérité de Control)
OnKeyUp Called before the KeyUp event occurs. (Hérité de Control)
OnLostFocus Called before the LostFocus event occurs. (Hérité de Control)
OnManipulationCompleted Called before the ManipulationCompleted event occurs. (Hérité de Control)
OnManipulationDelta Called before the ManipulationDelta event occurs. (Hérité de Control)
OnManipulationInertiaStarting Called before the ManipulationInertiaStarting event occurs. (Hérité de Control)
OnManipulationStarted Called before the ManipulationStarted event occurs. (Hérité de Control)
OnManipulationStarting Called before the ManipulationStarting event occurs. (Hérité de Control)
OnNavigatedFrom Invoked immediately after the Page is unloaded and is no longer the current source of a parent Frame.
OnNavigatedTo Invoked when the Page is loaded and becomes the current source of a parent Frame.
OnNavigatingFrom Invoked immediately before the Page is unloaded and is no longer the current source of a parent Frame.
OnPointerCanceled Called before the PointerCanceled event occurs. (Hérité de Control)
OnPointerCaptureLost Called before the PointerCaptureLost event occurs. (Hérité de Control)
OnPointerEntered Called before the PointerEntered event occurs. (Hérité de Control)
OnPointerExited Called before the PointerExited event occurs. (Hérité de Control)
OnPointerMoved Called before the PointerMoved event occurs. (Hérité de Control)
OnPointerPressed Called before the PointerPressed event occurs. (Hérité de Control)
OnPointerReleased Called before the PointerReleased event occurs. (Hérité de Control)
OnPointerWheelChanged Called before the PointerWheelChanged event occurs. (Hérité de Control)
OnRightTapped Called before the RightTapped event occurs. (Hérité de Control)
OnTapped Called before the Tapped event occurs. (Hérité de Control)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Hérité de DependencyObject)
ReleasePointerCapture Releases pointer captures for capture of one specific pointer by this UIElement. (Hérité de UIElement)
ReleasePointerCaptures Releases all pointer captures held by this element. (Hérité de UIElement)
RemoveHandler Removes the specified routed event handler from this UIElement. Typically the handler in question was added by AddHandler. (Hérité de UIElement)
SetBinding Attaches a binding to a FrameworkElement, using the provided binding object. (Hérité de FrameworkElement)
SetValue Sets the local value of a dependency property on a DependencyObject. (Hérité de DependencyObject)
TransformToVisual Returns a transform object that can be used to transform coordinates from the UIElement to the specified object. (Hérité de UIElement)
UpdateLayout Ensures that all positions of child objects of a UIElement are properly updated for layout. (Hérité de UIElement)

 

Propriétés

Le PageClasse contient les propriétés suivantes.

PropriétéType d’accèsDescription

ActualHeight

en lecture seuleGets the rendered height of a FrameworkElement. (Hérité de FrameworkElement)

ActualWidth

en lecture seuleGets the rendered width of a FrameworkElement. (Hérité de FrameworkElement)

AllowDrop

en lecture/écritureGets or sets a value that determines whether this UIElement can be a drop target for purposes of drag-and-drop operations. (Hérité de UIElement)

Background

en lecture/écritureGets or sets a brush that provides the background of the control. (Hérité de Control)

BaseUri

en lecture seuleGets 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. (Hérité de FrameworkElement)

BorderBrush

en lecture/écritureGets or sets a brush that describes the border background of a control. (Hérité de Control)

BorderThickness

en lecture/écritureGets or sets the border thickness of a control. (Hérité de Control)

BottomAppBar

en lecture/écritureGets a reference to an AppBar displayed at the bottom of the page, if any.

BottomAppBarProperty

en lecture seuleIdentifies the BottomAppBar dependency property.

CacheMode

en lecture/écritureGets or sets a value that indicates that rendered content should be cached as a composited bitmap when possible. (Hérité de UIElement)

CharacterSpacing

en lecture/écritureGets or sets the uniform spacing between characters, in units of 1/1000 of an em. (Hérité de Control)

Clip

en lecture/écritureGets or sets the RectangleGeometry used to define the outline of the contents of a UIElement. (Hérité de UIElement)

Content

en lecture/écritureGets or sets the content that is contained within a user control. (Hérité de UserControl)

DataContext

en lecture/écritureGets or sets the data context for a FrameworkElement when it participates in data binding. (Hérité de FrameworkElement)

DefaultStyleKey

en lecture/écritureGets or sets the key that references the default style for the control. (Hérité de Control)

DesiredSize

en lecture seuleGets the size that this UIElement computed during the measure pass of the layout process. (Hérité de UIElement)

Dispatcher

en lecture seuleGets the CoreDispatcher that this object is associated with. (Hérité de DependencyObject)

FlowDirection

en lecture/écritureGets 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. (Hérité de FrameworkElement)

FocusState

en lecture seuleGets a value that specifies whether this control has focus, and the mode by which focus was obtained. (Hérité de Control)

FontFamily

en lecture/écritureGets or sets the font used to display text in the control. (Hérité de Control)

FontSize

en lecture/écritureGets or sets the size of the text in this control. (Hérité de Control)

FontStretch

en lecture/écritureGets or sets the degree to which a font is condensed or expanded on the screen. (Hérité de Control)

FontStyle

en lecture/écritureGets or sets the style in which the text is rendered. (Hérité de Control)

FontWeight

en lecture/écritureGets or sets the thickness of the specified font. (Hérité de Control)

Foreground

en lecture/écritureGets or sets a brush that describes the foreground color. (Hérité de Control)

Frame

en lecture seuleGets the controlling Frame for the Page content.

FrameProperty

en lecture seuleIdentifies the Frame dependency property.

Height

en lecture/écritureGets or sets the suggested height of a FrameworkElement. (Hérité de FrameworkElement)

HorizontalAlignment

en lecture/écritureGets 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. (Hérité de FrameworkElement)

HorizontalContentAlignment

en lecture/écritureGets or sets the horizontal alignment of the control's content. (Hérité de Control)

IsDoubleTapEnabled

en lecture/écritureGets or sets a value that determines whether the DoubleTapped event can originate from that element. (Hérité de UIElement)

IsEnabled

en lecture/écritureGets or sets a value indicating whether the user can interact with the control. (Hérité de Control)

IsHitTestVisible

en lecture/écritureGets or sets whether the contained area of this UIElement can return true values for hit testing. (Hérité de UIElement)

IsHoldingEnabled

en lecture/écritureGets or sets a value that determines whether the Holding event can originate from that element. (Hérité de UIElement)

IsRightTapEnabled

en lecture/écritureGets or sets a value that determines whether the RightTapped event can originate from that element. (Hérité de UIElement)

IsTabStop

en lecture/écritureGets or sets a value that indicates whether a control is included in tab navigation. (Hérité de Control)

IsTapEnabled

en lecture/écritureGets or sets a value that determines whether the Tapped event can originate from that element. (Hérité de UIElement)

Language

en lecture/écritureGets 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. (Hérité de FrameworkElement)

ManipulationMode

en lecture/écritureGets or sets the ManipulationModes value used for UIElement behavior and interaction with gestures. (Hérité de UIElement)

Margin

en lecture/écritureGets or sets the outer margin of a FrameworkElement. (Hérité de FrameworkElement)

MaxHeight

en lecture/écritureGets or sets the maximum height constraint of a FrameworkElement. (Hérité de FrameworkElement)

MaxWidth

en lecture/écritureGets or sets the maximum width constraint of a FrameworkElement. (Hérité de FrameworkElement)

MinHeight

en lecture/écritureGets or sets the minimum height constraint of a FrameworkElement. (Hérité de FrameworkElement)

MinWidth

en lecture/écritureGets or sets the minimum width constraint of a FrameworkElement. (Hérité de FrameworkElement)

Name

en lecture/écritureGets 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. (Hérité de FrameworkElement)

NavigationCacheMode

en lecture/écritureGets or sets the navigation mode that indicates whether this Page is cached, and the period of time that the cache entry should persist.

Opacity

en lecture/écritureGets or sets the degree of the object's opacity. (Hérité de UIElement)

Padding

en lecture/écritureGets or sets the padding inside a control. (Hérité de Control)

Parent

en lecture seuleGets the parent object of this FrameworkElement in the object tree. (Hérité de FrameworkElement)

PointerCaptures

en lecture seuleGets the set of all captured pointers, represented as Pointer values. (Hérité de UIElement)

Projection

en lecture/écritureGets or sets the perspective projection (3-D effect) to apply when rendering this element. (Hérité de UIElement)

RenderSize

en lecture seuleGets the final render size of a UIElement. (Hérité de UIElement)

RenderTransform

en lecture/écritureGets or sets transform information that affects the rendering position of a UIElement. (Hérité de UIElement)

RenderTransformOrigin

en lecture/écritureGets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement. (Hérité de UIElement)

Resources

en lecture/écritureGets 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. (Hérité de FrameworkElement)

Style

en lecture/écritureGets or sets an instance Style that is applied for this object during layout and rendering. (Hérité de FrameworkElement)

TabIndex

en lecture/écritureGets or sets a value that determines the order in which elements receive focus when the user navigates through controls by pressing the Tab key. (Hérité de Control)

TabNavigation

en lecture/écritureGets or sets a value that modifies how tabbing and TabIndex work for this control. (Hérité de Control)

Tag

en lecture/écritureGets or sets an arbitrary object value that can be used to store custom information about this object. (Hérité de FrameworkElement)

Template

en lecture/écritureGets or sets a control template. The control template defines the visual appearance of a control in UI, and is defined in XAML markup. (Hérité de Control)

TopAppBar

en lecture/écritureGets a reference to an AppBar displayed at the top of the page, if any.

TopAppBarProperty

en lecture seuleIdentifies the TopAppBar dependency property.

Transitions

en lecture/écritureGets or sets the collection of Transition style elements that apply to a UIElement. (Hérité de UIElement)

Triggers

en lecture seuleGets the collection of triggers for animations that are defined for a FrameworkElement. Not commonly used. (Hérité de FrameworkElement)

UseLayoutRounding

en lecture/écritureGets 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. (Hérité de UIElement)

VerticalAlignment

en lecture/écritureGets 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. (Hérité de FrameworkElement)

VerticalContentAlignment

en lecture/écritureGets or sets the vertical alignment of the control's content. (Hérité de Control)

Visibility

en lecture/écritureGets 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. (Hérité de UIElement)

Width

en lecture/écritureGets or sets the width of a FrameworkElement. (Hérité de FrameworkElement)

 

Remarques

La classe Page vous permet de créer facilement une application du Windows Store pour Windows utilisant C++, C# ou Visual Basic, qui prend en charge la navigation. Vous utilisez la classe Page pour créer des morceaux de contenu qui prennent en charge la navigation à partir de Frame. Vous pouvez créer autant de pages différentes que nécessaire pour présenter le contenu dans votre application et naviguer ensuite vers ces pages à partir du frame.

De nombreuses applications permettent aux utilisateurs d'accéder plusieurs fois aux mêmes pages. Utilisez la propriété NavigationCacheMode pour spécifier s'il faut réutiliser ou recréer les instances de pages en revenant à une page.

Vous pouvez substituer chacune des méthodes suivantes pour ajouter du code répondant à des événements de navigation :

Page est généralement utilisé comme type de base, pour spécifier les unités de contenu auxquelles un objet Frame peut accéder. Pour cette raison, Page peut être utilisé comme élément racine du contenu XAML déclaré qui est stocké par les types personnalisés dérivés de Page, mais non comme un élément enfant dans des blocs de contenu XAML.

Exemples

L'exemple de code suivant montre la substitution de méthode OnLaunched générée pour le modèle d'application vierge dans Visual Studio. Ce code montre comment le contenu de la fenêtre d'application est défini sur un nouveau Frame, qui est ensuite parcouru jusqu'au Pageinitial par défaut.


protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    // Create a Frame to act navigation context and navigate to the first page
    var rootFrame = new Frame();
    rootFrame.Navigate(typeof(BlankPage));

    // Place the frame in the current Window and ensure that it is active
    Window.Current.Content = rootFrame;
    Window.Current.Activate();
}


Configuration requise

Client minimal pris en charge

Windows 8 [Applications du Windows Store uniquement]

Serveur minimal pris en charge

Windows Server 2012 [Applications du Windows Store uniquement]

Espace de noms

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

Métadonnées

Windows.winmd

Voir aussi

Frame
UserControl
Démarrage rapide : navigation entre les pages

 

 

Afficher:
© 2014 Microsoft