共用方式為


PageFunction<T>.Return 事件

定義

當傳回呼叫的 PageFunction<T> 且只能透過呼叫網頁進行處理時發生。

public:
 event System::Windows::Navigation::ReturnEventHandler<T> ^ Return;
public event System.Windows.Navigation.ReturnEventHandler<T> Return;
member this.Return : System.Windows.Navigation.ReturnEventHandler<'T> 
Public Custom Event Return As ReturnEventHandler(Of T) 

事件類型

範例

下列範例示範如何處理 Return 事件。

void callPageFunctionButton_Click(object sender, RoutedEventArgs e)
{
    // Create page function object
    GetStringPageFunction pageFunction = new GetStringPageFunction();

    // Detect when page function returns
    pageFunction.Return += new ReturnEventHandler<String>(PageFunction_Return);

    // Call page function
    this.NavigationService.Navigate(pageFunction);
}

void PageFunction_Return(object sender, ReturnEventArgs<String> e)
{
    // Retrieve page function return value
    string returnValue = e.Result;
}
Private Sub callPageFunctionButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    ' Create page function object
    Dim pageFunction As New GetStringPageFunction()

    ' Detect when page function returns
    AddHandler pageFunction.Return, AddressOf PageFunction_Return

    ' Call page function
    Me.NavigationService.Navigate(pageFunction)
End Sub

Private Sub PageFunction_Return(ByVal sender As Object, ByVal e As ReturnEventArgs(Of String))
    ' Retrieve page function return value
    Dim returnValue As String = e.Result
End Sub

備註

呼叫頁面會藉由處理 Return 來偵測呼叫 PageFunction<T> 傳回的時機。 此外,呼叫頁面可以從 傳遞至事件處理常式之 的 ReturnEventArgs<T> 屬性擷取 PageFunction<T> 傳回值 Result

XAML Attribute Usage

<object Return="ReturnEventHandler"/>  

適用於

另請參閱