3

I'm starting to learn Windows 8.1 phone development and I am trying to get the Content Dialog template to work inside a Pivot page. Work some reason, when I try to get the Add app bar button to navigate to the ContentDialog.xaml page, it is not displaying, but I see the navigate go to the ContentDialog constructor where the this.InitializeComponent() occurs.

I am finding very little online in way of examples on this template, so I am at a loss as to what I am missing. I understand that the ContentDialog page that was created from the template is inheriting from ContentDialog and not Page, but I'm not sure if this is still supposed to be directly accessed or if this XAML is supposed to be inside another "Page" XAML file.

Can someone please help.

The code looks like this in the Pivot page when the click event is selected:

Frame.Navigate(typeof(ContentDialog1));

I really haven't even touched the ContentDialog template from it's default yet, so it is set up like a set password page.

Thanks in advance

gcoleman0828
  • 1,450
  • 3
  • 30
  • 49

1 Answers1

4

UPDATE I found the answer to my question above. apparently, because it is a Content control, it needs to be called like a normal dialog would need to be called in it's code behind. I think my missconseption was that I thought it being "a template", that when I called it with the navigation calls that it would already have everything needed to get fired. You can also add the Content control to an existing page if you would like.

In either scenario, you need to add a method similar to this in your XAML.CS file.

 private async void OpenDialog()
    {
        await this.contentStuff.ShowAsync();
    }

You then need to call this method in the constructor. Then, when called, your dialog will appear.

Hope this helps others just starting out.

gcoleman0828
  • 1,450
  • 3
  • 30
  • 49