NavigationView.Expanding Evento

Definizione

Si verifica quando un nodo nell'albero inizia a espandersi.

// Register
event_token Expanding(TypedEventHandler<NavigationView, NavigationViewItemExpandingEventArgs const&> const& handler) const;

// Revoke with event_token
void Expanding(event_token const* cookie) const;

// Revoke with event_revoker
NavigationView::Expanding_revoker Expanding(auto_revoke_t, TypedEventHandler<NavigationView, NavigationViewItemExpandingEventArgs const&> const& handler) const;
public event TypedEventHandler<NavigationView,NavigationViewItemExpandingEventArgs> Expanding;
function onExpanding(eventArgs) { /* Your code */ }
navigationView.addEventListener("expanding", onExpanding);
navigationView.removeEventListener("expanding", onExpanding);
- or -
navigationView.onexpanding = onExpanding;
Public Custom Event Expanding As TypedEventHandler(Of NavigationView, NavigationViewItemExpandingEventArgs) 
<NavigationView Expanding="eventhandler" />

Tipo evento

Esempio

Nell'esempio seguente viene creato un oggetto NavigationView gerarchico e viene configurato un gestore eventi per l'evento Expanding denominato OnItemExpanding. In questo gestore eventi la proprietà Content dell'elemento espanso è impostata su come visualizzare in ExpandingItemLabel TextBlock.

<muxc:NavigationView x:Name="navview"
    MenuItemsSource="{x:Bind categories, Mode=OneWay}"
    Expanding="OnItemExpanding"
    Collapsed="OnItemCollapsed"
    PaneDisplayMode="Left">

    <StackPanel Margin="10,10,0,0">
        <TextBlock Margin="0,10,0,0" x:Name="ExpandingItemLabel" Text="Last Expanding: N/A"/>
        <TextBlock x:Name="CollapsedItemLabel" Text="Last Collapsed: N/A"/>
    </StackPanel>
</muxc:NavigationView>
private void OnItemExpanding(object sender, NavigationViewItemExpandingEventArgs e)
{
    var nvib = e.ExpandingItemContainer;
    var name = "Last Expanding: " + nvib.Content.ToString();
    ExpandingItemLabel.Text = name;
}

Commenti

Per compilare i nodi durante l'espansione, impostare la proprietà HasUnrealizedChildren su true e quindi aggiungere gli elementi figlio durante questo evento Di espansione. Vedere l'esempio TreeView riempire un nodo quando si espande.

Analogo all'evento TreeView.Expanding .

Si applica a