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