none
Create HubSection in c# RRS feed

  • Question

  • Hi,

    I am a little confused for the new control (Hub, replacing the Panorama control).

    In my old WP8 code I had:

    PanoramaItem panoItem = new PanoramaItem(); ScrollViewer sv = new ScrollViewer(); StackPanel sp = new StackPanel(); ProgressBar pb = new ProgressBar(); pb.Height = 200; pb.IsIndeterminate = true; sp.Children.Add(pb); sv.Content = sp;

    panoItem.Header = "Header";

    panoItem.Content = sv;

    // PanoramaContent is the Panorama Control in XAML PanoramaContent.Items.Add(panoItem);


    Now, I want to "translate" this code for WP8.1 but I can't find a way to do it.

    I was expecting something like:

    HubSection panoItem = new HubSection(); ScrollViewer sv = new ScrollViewer(); StackPanel sp = new StackPanel(); ProgressBar pb = new ProgressBar(); pb.Height = 200; pb.IsIndeterminate = true; sp.Children.Add(pb); sv.Content = sp;

    panoItem.Header = "Header";

    panoItem.Content = ?????? ContentPanorama.Sections.Add(panoItem);

    How can I insert a content in the Hub? In my case a ScrollViewer control?

    Thanks,

    Adriano

    Wednesday, June 11, 2014 9:26 PM

All replies

  • I haven't used this control. See if this link XAML Hub control sample give you any ideas?
    Wednesday, June 11, 2014 9:38 PM
  • Hi Ahmad,

    thanks but it is sooo complicated.

    I found a workaround:

    HubSection panoItem = new HubSection();
    panoItem.Header = "header";
    
    panoItem.ContentTemplate = PanoramaContent.Sections[0].ContentTemplate;
    panoItem.ContentTemplate.LoadContent();
                    
    PanoramaContent.Sections.Add(panoItem);

    In this way, I will use the same XAML structure of the first panoramaItem.

    It is not so nice as create a new dynamically control, but it works for my project.


    Wednesday, June 11, 2014 9:46 PM