WPF: Dynamically position label in grid

M

moondaddy

I have a window which has textboxes in it and when each textbox get the
focus, I need to position a small label directly under the textbox and right
aligned so the right side of the label and the right side of the textbox are
inline. I could do this in a canvas but I have no idea how to do it in a
grid.



Any good ideas?



This is how I did it in the canvas:



Canvas.SetTop(lblTextLength, Canvas.GetTop(ctl) + ctl.Height +
_textLengthCounterTopOffset);



Canvas.SetLeft(lblTextLength, Canvas.GetLeft(ctl) + ctl.Width +
_textLengthCounterLeftOffset);



lblTextLength.Visibility = Visibility.Visible;





Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top