Enviando el evento LoadingPivotItem a PivotItems (UserControls)
Entonces, tengo Pivot y PivotItems como UserControls. Me gustaría saber cuándo cada PivotItem es NavigatedTo y NavigatedFrom.
Hice una clase base (los PivotItems lo están heredando), agregué allí 2 métodos (Hasta y Desde), y tengo LoadingPivotItemCommand () en el pivote, así que sé qué PivotItem está cargado.
¿Pero cómo transmitir este evento a pivotes? Intenté algunas formas, pero todas son nulas.
void LoadingPivotItemCommand(PivotItemEventArgs args)
{
var b = args.Item.Parent as BaseUserControl;
var a = args.Item.Content as BaseUserControl;
var a1 = args.Item.Content as UserControl;
var c = args.Item.DataContext as BaseUserControl;
if (c != null)
c.OnPivotItemActivated();
}
Los PivotItems están definidos en xaml:
<controls:PivotItem Header="{Binding Path=MainResources.Products, Source={StaticResource LocalizedStrings}, Converter={StaticResource StringToLowerCaseConverter}}"
Name="PivotItemProducts">
<Grid>
<productsView:ProductUserControl />
</Grid>
</controls:PivotItem>