Change the location of control at runtime in WPF application.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Farhomar
    New Member
    • Aug 2007
    • 6

    Change the location of control at runtime in WPF application.

    How to change the location (left and top) of the image control in wpf windows application at runtime?
  • cloud255
    Recognized Expert Contributor
    • Jun 2008
    • 427

    #2
    To move a control at runtime (in C#):

    create a new point:
    Code:
    system.drawing.point pt = new system.drawing.point();
    set the new co-ordinates:
    Code:
    pt.X = newX;
    pt.Y = newY;
    set the co-ordinates of your control:
    Code:
    myControl.location = pt;
    myControl.refresh();
    and the control should have moved.

    Comment

    • lcgg15
      New Member
      • Feb 2013
      • 2

      #3
      in wpf, there is no .location

      Comment

      Working...