Share via


Frame.NavigationService Propriedade

Definição

Obtém o NavigationService que é usado por este Frame para fornecer serviços de navegação.

public:
 property System::Windows::Navigation::NavigationService ^ NavigationService { System::Windows::Navigation::NavigationService ^ get(); };
public System.Windows.Navigation.NavigationService NavigationService { get; }
member this.NavigationService : System.Windows.Navigation.NavigationService
Public ReadOnly Property NavigationService As NavigationService

Valor da propriedade

NavigationService

Um Frame objeto que representa o NavigationService usado por isso Frame, se estiver disponível. Caso contrário, null será retornado.

Comentários

Frame usa NavigationService para dar suporte à navegação para conteúdo hospedado. NavigationService é útil para o código que hospeda um Frame para obter uma referência ao NavigationService. O conteúdo hospedado por um Frame, por Pageexemplo, deve ser usado GetNavigationService ou NavigationService para obter uma referência ao NavigationService.

Observação

NavigationService não retorna uma referência ao mesmo NavigationService que chamar GetNavigationService e passar Frame . O primeiro retorna o NavigationService que pertence ao Frame enquanto o último retorna o NavigationService host de navegação que navegou até o conteúdo no qual o Frame está hospedado. O código a seguir demonstra as diferenças.

using System.Windows.Controls;
using System.Windows.Navigation;
Imports System.Windows.Controls
Imports System.Windows.Navigation
// Get the NavigationService owned by the Frame
NavigationService frameNS = this.frame.NavigationService;

// Get the NavigationService for the navigation host that navigated
// to the content in which the Frame is hosted
NavigationService navigationHostNS = NavigationService.GetNavigationService(this.frame);
' Get the NavigationService owned by the Frame
Dim frameNS As NavigationService = Me.frame.NavigationService

' Get the NavigationService for the navigation host that navigated
' to the content in which the Frame is hosted
Dim navigationHostNS As NavigationService = NavigationService.GetNavigationService(Me.frame)

Aplica-se a