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. C#
  4. getting the parent control from a child control at runtime.

getting the parent control from a child control at runtime.

Scheduled Pinned Locked Moved C#
csharpwpf
3 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.
  • X Offline
    X Offline
    Xandip
    wrote on last edited by
    #1

    hi there, I have a simple WPF window with a button in it. now during runtime, i pass this button control to another function, and there, i want to know the parent of this control. ie the window, with the full namespace. any way for this thru C#

    The name is Sandeep

    C 1 Reply Last reply
    0
    • X Xandip

      hi there, I have a simple WPF window with a button in it. now during runtime, i pass this button control to another function, and there, i want to know the parent of this control. ie the window, with the full namespace. any way for this thru C#

      The name is Sandeep

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      We have a WPF forum. The control has a parent property, to know the type, you can use the GetType method, you can also use reflection. Any method that gets passed a control, sounds a little ugly to me.

      Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

      X 1 Reply Last reply
      0
      • C Christian Graus

        We have a WPF forum. The control has a parent property, to know the type, you can use the GetType method, you can also use reflection. Any method that gets passed a control, sounds a little ugly to me.

        Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

        X Offline
        X Offline
        Xandip
        wrote on last edited by
        #3

        hi, thnx for the reply..

        The name is Sandeep

        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