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. Events between user controls

Events between user controls

Scheduled Pinned Locked Moved WPF
helpquestioncsharpcsswpf
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.
  • D Offline
    D Offline
    David_ml_G
    wrote on last edited by
    #1

    Hi, I'm developing my first application in WPF and I got stuck on this. I have one Solution with several projects. I have a project for the main window, one for the menus, and another for the controls. The logic is that the main window will have one (or several) menu, and the menu has, again, one or several customized controls. The reason I did this is because I'll be needing to re-use the same controls and menus on a different configuration for the next project. Now for my question... let's say that my projects are called "Controls", "Menus" and "Main". I have a customized button(user control) and a customized canvas(user control) in "Controls". Now, everything goes to the main window in "Main", the button goes inside the menu from "Menus" wich in turn goes to the main window, and the canvas goes directly to the main window grid. My struggle is how to raise an event from the button once is clicked and that in the canvas a control(let's say a text box) appear at a location designated either by me or the user. Is there a way to do this? I've tried with dependency properties but with complete failure. I'd appreciate for any kind of help. Thanks

    A 1 Reply Last reply
    0
    • D David_ml_G

      Hi, I'm developing my first application in WPF and I got stuck on this. I have one Solution with several projects. I have a project for the main window, one for the menus, and another for the controls. The logic is that the main window will have one (or several) menu, and the menu has, again, one or several customized controls. The reason I did this is because I'll be needing to re-use the same controls and menus on a different configuration for the next project. Now for my question... let's say that my projects are called "Controls", "Menus" and "Main". I have a customized button(user control) and a customized canvas(user control) in "Controls". Now, everything goes to the main window in "Main", the button goes inside the menu from "Menus" wich in turn goes to the main window, and the canvas goes directly to the main window grid. My struggle is how to raise an event from the button once is clicked and that in the canvas a control(let's say a text box) appear at a location designated either by me or the user. Is there a way to do this? I've tried with dependency properties but with complete failure. I'd appreciate for any kind of help. Thanks

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #2

      Not sure where the coordinates will come from, but let's assume it will be a dependency property on your custom button. You can then programmatically bind to that property from your menu. There will be a dependency property on your menu that the binding is set to update. You can then bind to that property from the textbox so that the canvas coordinates get updated. You can also update the visibility of the textbox using an IValueConverter that converts a bool (another dependency property linked between the button and menu) to a visibility value. Not sure I understood your question correctly, but hopefully those ideas will help you get a start.

      [Forum Guidelines]

      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