So, i have Pivot and PivotItems as UserControls. I'd like to know, when every PivotItem is NavigatedTo and NavigatedFrom.
I made a base class (PivotItems are inheriting it), added there 2 methods (To and From), and i have LoadingPivotItemCommand() in the pivot, so i know, which PivotItem is loaded.
But how to broadcast this event to pivots? I tried some ways, but all of them are nulls.
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();
}
PivotItems are defined in xaml:
<controls:PivotItem Header="{Binding Path=MainResources.Products, Source={StaticResource LocalizedStrings}, Converter={StaticResource StringToLowerCaseConverter}}"
Name="PivotItemProducts">
<Grid>
<productsView:ProductUserControl />
</Grid>
</controls:PivotItem>