Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Best Way To Design This

Best Way To Design This

Scheduled Pinned Locked Moved WPF
questionwpfcomgraphicsdesign
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I want to create menu in my app that looks like Zune[^] So I styled a button, and it looks fine. The question is, what's the best way to load this? Would you define each button on its own in XAML or use some kind of list or stackpanel that's bound to the VM? I would like the menu(s) to be dynamic, so I will have to bind the Caption, the Visibility, and the Command would be bound to something like Button1Command, Button2Command, ect. Then in the code behind determine what to do based of the state of the app. Also, when a button is clicked, it's FontWeight needs to be set to bold, and all other buttons to Normal. How would you do this? Sugggestions? Thanks

    If it's not broken, fix it until it is

    A U 3 Replies Last reply
    0
    • K Kevin Marois

      I want to create menu in my app that looks like Zune[^] So I styled a button, and it looks fine. The question is, what's the best way to load this? Would you define each button on its own in XAML or use some kind of list or stackpanel that's bound to the VM? I would like the menu(s) to be dynamic, so I will have to bind the Caption, the Visibility, and the Command would be bound to something like Button1Command, Button2Command, ect. Then in the code behind determine what to do based of the state of the app. Also, when a button is clicked, it's FontWeight needs to be set to bold, and all other buttons to Normal. How would you do this? Sugggestions? Thanks

      If it's not broken, fix it until it is

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      You create a single style in a central location. This is called the resource dictionary. You then use this style in any buttons defined in any xaml. It is not advisable to have this style copy pasted in every single xaml. That would be a maintenance nightmare. The Visual State Manager class[^] should help you setup a transition for the fontweight task. You can also set up a simple animation for this task.

      Build your own survey - http://www.factile.net

      1 Reply Last reply
      0
      • K Kevin Marois

        I want to create menu in my app that looks like Zune[^] So I styled a button, and it looks fine. The question is, what's the best way to load this? Would you define each button on its own in XAML or use some kind of list or stackpanel that's bound to the VM? I would like the menu(s) to be dynamic, so I will have to bind the Caption, the Visibility, and the Command would be bound to something like Button1Command, Button2Command, ect. Then in the code behind determine what to do based of the state of the app. Also, when a button is clicked, it's FontWeight needs to be set to bold, and all other buttons to Normal. How would you do this? Sugggestions? Thanks

        If it's not broken, fix it until it is

        A Offline
        A Offline
        Abhinav S
        wrote on last edited by
        #3

        You create a single style in a central location. This is called the resource dictionary. You then use this style in any buttons defined in any xaml. It is not advisable to have this style copy pasted in every single xaml. That would be a maintenance nightmare. The Visual State Manager class[^] should help you setup a transition for the fontweight task. You can also set up a simple animation for this task.

        Build your own survey - http://www.factile.net

        1 Reply Last reply
        0
        • K Kevin Marois

          I want to create menu in my app that looks like Zune[^] So I styled a button, and it looks fine. The question is, what's the best way to load this? Would you define each button on its own in XAML or use some kind of list or stackpanel that's bound to the VM? I would like the menu(s) to be dynamic, so I will have to bind the Caption, the Visibility, and the Command would be bound to something like Button1Command, Button2Command, ect. Then in the code behind determine what to do based of the state of the app. Also, when a button is clicked, it's FontWeight needs to be set to bold, and all other buttons to Normal. How would you do this? Sugggestions? Thanks

          If it's not broken, fix it until it is

          U Offline
          U Offline
          Unnikrishnan_S_N
          wrote on last edited by
          #4

          I am not aware of Zune, however, I think you can use a Menu control and set its source to a collection ObservableCollection MenuItems. interface IMenuItem { string Caption; Visibility MenuVisibility; ICommand Command;} Bind the above properties in the MenuItem's ItemTemplate or HiearchicalTemplate. Apply DataTrigger on the MenuVisibility property to set visibility. Also you can customize the default menuitem's template style and modify the template as per your requirement. Please refer the below link which will give an idea on how to use the menu item template. http://msdn.microsoft.com/en-us/library/ms752296%28v=vs.85%29[^] http://msdn.microsoft.com/en-us/library/ms747082%28v=vs.85%29.aspx[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups