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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:13:59+00:00 2026-05-28T06:13:59+00:00

I made a style for my menu control and now I want to use

  • 0

I made a style for my menu control and now I want to use that style for all the menuItems, but with different text in the textbox. I was wondering if I can use a List to populate the binding element…I tried but it doesnt work…Have I missed something or I have to use something else?

  List<string> itemArray = new List<string>();
        itemArray.Add("label1");
        itemArray.Add("label2");
        itemArray.Add("label3");
        Binding binding = new Binding();
        binding.Path = new PropertyPath("itemArray");

       this.menu1.SetBinding(TextBox.TextProperty, binding);

and the one part of the style is, if it helps…:

 <Setter.Value>
    <ControlTemplate TargetType="{x:Type MenuItem}">
        <Grid>
            <Border Name="MainBorder" BorderThickness="2,2,2,0" >
                <Grid>
                    <TextBlock Text="{Binding Path=itemArray}" Margin="30,10,0,0" FontFamily="Arial" FontSize="14" FontWeight="Bold" />
                    <Image Width="15" Height="15" Source="image.PNG" Margin="-100,0,0,0" />
                </Grid>
            </Border>
        </Grid>
    </ControlTemplate>
</Setter.Value>
  • 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-28T06:13:59+00:00Added an answer on May 28, 2026 at 6:13 am

    You’re trying to bind a text element to a List<T>, which will result in the type name. If you want the menu to populate itself from a list of objects, consider binding the menu’s ItemsSource property to that list:

         <Menu ItemsSource="{Binding ListOfItems}">
            <Menu.ItemTemplate>
               <DataTemplate>
                  <MenuItem Header="{Binding Text}" Command="{Binding Command}" />
               </DataTemplate>
            </Menu.ItemTemplate>
         </Menu>
    

    In this example, each list item is an object with a Text property which shows up as the display string, and a Command property, which is an object that implements ICommand. When the user chooses a menu item, that list item’s Command.Execute method is invoked; you could use something like RelayCommand or ReactiveCommand to turn that into a method call.

    This allows for a flat menu; for a hierarchical menu you’ll have to do something a little different.

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

Sidebar

Related Questions

i made a vertical menu. I want that the first tab has a different
I need a menu that looks like a select box, but is made from
I made myself a template for all JSPs in my webapp that keeps things
I want to make an html / css menu in my webpage that contain
I've got a navigation menu that is made of nested ul lists like this:
I made a menu, and just now I added <!DOCTYPE html> to the document,
I made a site with simple instructions let's say: <html> <head> <style type=text/css> .a120
I have this menu I found how to made on a tutorial but I
On this website: www.americaspoeticsoul.com I made a menu. Now, I just looked at it
I have made a drop down menu which is working fine, but when i

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.