I have a split view inside of MainPage with its pane and content defined as 's
The pane Frame contains a page which has a PageListView. When the items in the list view are clicked I wish to update the content frame.
In the declaration of the listview page I have a delegate event handler called ItemChangedEventHandler. When the listview item is clicked I call the EventHandler which would then notify all objects subscribed to the event.
My problem is I don't have a reference to the pane Page. Is there a way to instantiate a page and then pass that to the Navigate method? If I could instantiate it before navigating to it then I could reference the PageListView.ItemChanged which wouldn't be null as it is in the code below and add the event handler would be fine. I don't know how to do this. Any suggestions would be great.
PageListView
public delegate void ItemChangedEventHandler(object sender, Item item);
public sealed partial class PageListView : Page
{
private void PageListView_ItemClick(object sender, ItemClickEventArgs e)
{
Item item = (Item)e.ClickedItem;
ItemChanged(this, item);
}
}
MainPage
public MainPage()
{
this.InitializeComponent();
SplitViewPaneFrame.Navigate(typeof(PageListView));
PageListView.ItemChanged += new ItemChangedEventHandler(Item_Clicked);
}
private void Item_Clicked(Object sender, Item item)
{
SplitViewContentFrame.Navigate(typeof(DetailPage), item);
}