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. WCF and WF
  4. UserControl and Attached Event

UserControl and Attached Event

Scheduled Pinned Locked Moved WCF and WF
questioncss
4 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.
  • B Offline
    B Offline
    BlitzPackage
    wrote on last edited by
    #1

    Greetings good people, I have a user control that I place in my main grid (LayoutRoot) that handles the layout for the window. There are several buttons in the main grid (LayoutRoot) that serve different purposes depending on what's loaded in the main content area. The button's function and purpose depends on which user control is loaded. In turn, the user control has to perform several actions in response to which specific multipurpose button was pressed. I am trying to use an attached event to coordinate these activities. How do I get the user control to know which multipurpose button was clicked; and then have one of the user control's constituent elements undertake some actions in response to the event (e.g. button click)? Thanks, Blitz

    C 1 Reply Last reply
    0
    • B BlitzPackage

      Greetings good people, I have a user control that I place in my main grid (LayoutRoot) that handles the layout for the window. There are several buttons in the main grid (LayoutRoot) that serve different purposes depending on what's loaded in the main content area. The button's function and purpose depends on which user control is loaded. In turn, the user control has to perform several actions in response to which specific multipurpose button was pressed. I am trying to use an attached event to coordinate these activities. How do I get the user control to know which multipurpose button was clicked; and then have one of the user control's constituent elements undertake some actions in response to the event (e.g. button click)? Thanks, Blitz

      C Offline
      C Offline
      ColinM123
      wrote on last edited by
      #2

      Can you use RoutedEvents? It should tunnel down to your usercontrol where you can take action.

      Online Guitar Tools

      B 1 Reply Last reply
      0
      • C ColinM123

        Can you use RoutedEvents? It should tunnel down to your usercontrol where you can take action.

        Online Guitar Tools

        B Offline
        B Offline
        BlitzPackage
        wrote on last edited by
        #3

        Thanks for replying. Indeed I am trying that approach. However, the buttons are children of the main grid. The user control is also a child of the main grid. I don't think, therefore, they share the same visual or logical tree. Thus far, it seems that the button click events travel all the way up to the main grid. It doesn't seem as if my user control can hear the button click events. Any thoughts?

        C 1 Reply Last reply
        0
        • B BlitzPackage

          Thanks for replying. Indeed I am trying that approach. However, the buttons are children of the main grid. The user control is also a child of the main grid. I don't think, therefore, they share the same visual or logical tree. Thus far, it seems that the button click events travel all the way up to the main grid. It doesn't seem as if my user control can hear the button click events. Any thoughts?

          C Offline
          C Offline
          ColinM123
          wrote on last edited by
          #4

          How about bubbling the button clicks up. Catching them on the LayoutGrid then raise a new tunneling event, which is sent down to your usercontrol. Not sure if this is a good idea, maybe somebody else will chime in.

          Online Guitar Tools

          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