0

the Rectangle in a table made by grid(4*4) , i want to move it by keboard up.right.left and down

<Rectangle Name="pic" Grid.Row=" 0" Grid.Column="0" >
        <Rectangle.Fill>
            <ImageBrush ImageSource="d0c8a786c9177f3ea9ab277d70cf3bc79f3d5627.jpg"/>
        </Rectangle.Fill>
    </Rectangle>
Bubble
  • 327
  • 2
  • 4
  • 13
  • 1
    Show what you have tried. When nothing, take a look at [this question](http://stackoverflow.com/questions/1626830/move-focus-in-response-to-keyboard-events-in-xaml), where input events on the control are bound to a `CommandBinding`, in which you can write the code to move the element according to the pressed key(s). – CodeCaster Jun 15 '13 at 14:08

1 Answers1

0

If you mean how to move a control from one Column/Row to another then use static Grid.SetColumn Method and Grid.SetRow Method in your keypress handler.

Grid.SetColumn(pic, newColumnNumber);
Grid.SetRow(pic, newRowNumber);
LPL
  • 16,827
  • 6
  • 51
  • 95