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. Firing an ICommand from a Style?

Firing an ICommand from a Style?

Scheduled Pinned Locked Moved WPF
wpfdesignquestion
2 Posts 2 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.
  • S Offline
    S Offline
    SledgeHammer01
    wrote on last edited by
    #1

    What's the preferred way to add an event -> ICommand mapping from within a style. I know I can do this use the i:interaction stuff *IF* I'm re-templating. In my case, I do not want to re-template. I just want to add an event handler through the style (because the base style must remain generic). There is no "root" UIElement to add to either. Specifically, I'm trying to handle an event thats coming from the TreeViewItem in my VM. I template the TreeViewItem in my UI Library, but I can't have app specific stuff in there. Don't want to copy the styles over because they are quite large and they really need to remain in the UI library so I don't have to maintain 2 copies. I've seen some mention of attached behaviors, but it seems like you can only add a single attached command through a style??

    C 1 Reply Last reply
    0
    • S SledgeHammer01

      What's the preferred way to add an event -> ICommand mapping from within a style. I know I can do this use the i:interaction stuff *IF* I'm re-templating. In my case, I do not want to re-template. I just want to add an event handler through the style (because the base style must remain generic). There is no "root" UIElement to add to either. Specifically, I'm trying to handle an event thats coming from the TreeViewItem in my VM. I template the TreeViewItem in my UI Library, but I can't have app specific stuff in there. Don't want to copy the styles over because they are quite large and they really need to remain in the UI library so I don't have to maintain 2 copies. I've seen some mention of attached behaviors, but it seems like you can only add a single attached command through a style??

      C Offline
      C Offline
      Cracked Down
      wrote on last edited by
      #2

      whats the event that you want to handle? is it selection event? if it is, then you dont have to goto style for this

      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