Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8575071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:36:50+00:00 2026-06-11T19:36:50+00:00

Situation: I have a panorama control with 2 panorama items. First item contain the

  • 0

Situation:
I have a panorama control with 2 panorama items. First item contain the list of options and, if i choose one of them, panorama control should switch to second item. As you understand, the content of second item should be dynamically updated each time. Moreover the ItemTemplate should be different for each option.
My solution:
I decide to create panorama control each time i need to switch (because the only way to switch panorama item programmatically is to change DefaultItem property which requires reload the page or to hide this and show another control). This solution works, but now i need to assign different ItemTemplate for each panorama item. (Templates are in xaml. I need just to assign it).
Questions:
Is my solution correct?
And how can i assign ItemTemplate’s in code behind?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:36:51+00:00Added an answer on June 11, 2026 at 7:36 pm

    how can i assign ItemTemplate’s in code behind?

    The solution looks like this:

    public void constructUI()
    {
    
    Panorama panoramactrl = new Panorama();
    
    PanoramaItem panoramaItem = new PanoramaItem();
    panoramaItem.Header = "main";
    PanoramaItem panoramaItem1 = new PanoramaItem();
    panoramaItem1.Header = "not main";
    
    ListBox listBox = new ListBox();
    listBox.ItemsSource = CreatePanoramaItems();
    
    DataTemplate itemTmp = (DataTemplate)XamlReader.Load(
    
        @"<DataTemplate xmlns=""http://schemas.microsoft.com/client/2007"">
        <StackPanel Tag=""{Binding id}"">
        <TextBlock Text=""{Binding FirstRaw}"" Foreground=""Red"" FontSize=""40"" />
        <TextBlock Text=""{Binding SecondRaw}"" Foreground=""Orange"" FontSize=""30"" Margin=""10,0,0,0"" />
        </StackPanel>
        </DataTemplate>");
    
    listBox.ItemTemplate = itemTmp;
    panoramaItem.Content = listBox;
    panoramactrl.Items.Add(panoramaItem);
    panoramactrl.Items.Add(panoramaItem1);
    this.LayoutRoot.Children.Add(panoramactrl);
    

    }

    private List<Data> CreatePanoramaItems()
    {
        List<Data> Panoramaitems = null;
        Panoramaitems = new List<Data> 
        { 
        new Data("123", "456", "1"),
        new Data("234", "567", "2"),
        new Data("345", "678", "3")
        };
        return Panoramaitems;
    }
    

    Hope this will be helpful for someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Situation I have a QList<QVariant> where each QVariant item should be a QList<QVariant> of
[Situation] I have a custom item control which I add to a stack panel
Situation I have 5 Access DB files, each one has 10 tables, 40 queries
Situation: I have a multithreaded program written in C. If one of the threads
Situation: We have several small icons on our Magento Product page. After clicking one,
Situation: I have two dojo autocompleters on a jsp. Both of them trigger the
Situation: We have employees that are requesting for a feature that allows them to
Situation: you have a web page with a form that has a first name
Situation: I have several Gridviews on one page, and each Gridview has a dynamically
I have situation, where I want to read configuration file only one time, when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.