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 3341832
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:46:05+00:00 2026-05-18T00:46:05+00:00

I have been searching all over the web trying to find an example of

  • 0

I have been searching all over the web trying to find an example of databinding an Accordion control.

I have written a simple test app to try and databind, and I can get the headers to bind, but can’t seem to figure out how to get the content to bind. Could someone help me out?

Here is my XAML:

<tk:Accordion HorizontalAlignment="Left" Margin="12,12,0,0" Name="accordion1" Width="181" Height="325" Background="White" VerticalAlignment="Top">
    <tk:Accordion.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding MenuHeaderName}" />
            </StackPanel>
        </DataTemplate>
    </tk:Accordion.ItemTemplate>
    <tk:Accordion.ContentTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding Path=MenuItems.MenuItemName}" />
            </StackPanel>
        </DataTemplate>
    </tk:Accordion.ContentTemplate>         
</tk:Accordion>

And here is my code behind:

public partial class MainPage : UserControl
{
    public class MenuItem
    {
        public MenuItem(string name) { MenuItemName = name; }
        public string MenuItemName { get; set; }
    }

    public class MenuHeader
    {
        public MenuHeader(string name) 
        { 
            MenuItems = new List<MenuItem>(); 
            MenuHeaderName = name; 
        }
        public string MenuHeaderName { get; set; }
        public List<MenuItem> MenuItems { get; set; }
    }

    public MainPage()
    {
        InitializeComponent();

        List<MenuHeader> menuHeaders = new List<MenuHeader>();

        MenuHeader robots = new MenuHeader("Robots");
        robots.MenuItems.Add(new MenuItem("Robots - Item 1"));
        robots.MenuItems.Add(new MenuItem("Robots - Item 2"));
        robots.MenuItems.Add(new MenuItem("Robots - Item 3"));
        menuHeaders.Add(robots);

        MenuHeader pirates = new MenuHeader("Pirates");
        pirates.MenuItems.Add(new MenuItem("Pirates - Item 1"));
        pirates.MenuItems.Add(new MenuItem("Pirates - Item 2"));
        pirates.MenuItems.Add(new MenuItem("Pirates - Item 3"));
        menuHeaders.Add(pirates);

        accordion1.ItemsSource = menuHeaders;
    }
}
  • 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-05-18T00:46:05+00:00Added an answer on May 18, 2026 at 12:46 am

    Figured it out.

    Here is the XAML that works…

        <tk:Accordion HorizontalAlignment="Left" Margin="12,12,0,0" Name="accordion1" Width="181" Height="325" Background="White" VerticalAlignment="Top">
            <tk:Accordion.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding MenuHeaderName}" />
                    </StackPanel>
                </DataTemplate>
            </tk:Accordion.ItemTemplate>
            <tk:Accordion.ContentTemplate>
                <DataTemplate>
                    <ListBox ItemsSource="{Binding MenuItems}" BorderThickness="0">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding MenuItemName}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </DataTemplate>
            </tk:Accordion.ContentTemplate>         
        </tk:Accordion>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been searching all over trying to find simple code to add multiple markers
I have been searching the web and all over stackoverflow, but yet couldn't find
I have been searching all over the Internet, but did not find that exact
I have been searching all over but I can't find any answer to this.
I have been searching all over the net to try and find a way
I have been searching all over and i cant seem to find a solution.
Have been searching all over the internet but struggling to find my answer to
Any help on existing tab control like Chrome tabs? I have been searching all
I have been extensively searching all over the net last night until today and
I've been searching all over for an example of the XML needed to setup

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.