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. How to get the control position to add another control below that?

How to get the control position to add another control below that?

Scheduled Pinned Locked Moved WPF
questionhelptutorial
3 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.
  • S Offline
    S Offline
    salon
    wrote on last edited by
    #1

    I have a custom control which dynamically add texboxes...This control is inherited from StackPanel.... Now I have a collection of textboxes which will dynamically added to the StackPanel. I want to add a message control below each text box and manually hide and show that...which will have hanging kind of look... My question is that, how can I add the message control dynamically below each textbox control? I think I am trying to get the X, Y coordinates of the textbox on mousemove event and trying to place the message control but not able to get any result... Can anybody help me? Thanks in advance,

    R M 2 Replies Last reply
    0
    • S salon

      I have a custom control which dynamically add texboxes...This control is inherited from StackPanel.... Now I have a collection of textboxes which will dynamically added to the StackPanel. I want to add a message control below each text box and manually hide and show that...which will have hanging kind of look... My question is that, how can I add the message control dynamically below each textbox control? I think I am trying to get the X, Y coordinates of the textbox on mousemove event and trying to place the message control but not able to get any result... Can anybody help me? Thanks in advance,

      R Offline
      R Offline
      Ray Cassick
      wrote on last edited by
      #2

      Not tried it yet, but I think if you just add controls to a stack panel that has its orientation set of vertical, they get added in first-in order. This should just keep putting then one under the next. As far as I know the insert method of the stack panels children collection allows for an index number to be given though, so you could do it that way also I guess.


      LinkedIn[^] | Blog[^] | Twitter[^]

      1 Reply Last reply
      0
      • S salon

        I have a custom control which dynamically add texboxes...This control is inherited from StackPanel.... Now I have a collection of textboxes which will dynamically added to the StackPanel. I want to add a message control below each text box and manually hide and show that...which will have hanging kind of look... My question is that, how can I add the message control dynamically below each textbox control? I think I am trying to get the X, Y coordinates of the textbox on mousemove event and trying to place the message control but not able to get any result... Can anybody help me? Thanks in advance,

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        salon wrote:

        Now I have a collection of textboxes which will dynamically added to the StackPanel.

        An alternative to doing all this manually from code would be to use a collection of a data type that has the required properties for each item. Then using an ItemsControl (or derived) you can use a data template for the items, so each time you add an item to the collection, all the UI elements for the item will be magically created using the template. Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        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