แก้ไข

แชร์ผ่าน


PageFunction<T>.Return Event

Definition

Occurs when a called PageFunction<T> returns, and can only be handled by the calling page.

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) 

Event Type

Examples

The following example shows how to handle the Return event.

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

Remarks

A calling page detects when a called PageFunction<T> returns by handling Return. Additionally, the calling page can retrieve the PageFunction<T> return value from the Result property of the ReturnEventArgs<T> which is passed to the event handler.

XAML Attribute Usage

<object Return="ReturnEventHandler"/>  

Applies to

See also