windows runtime - Win RT how to place button in specific coordinates? -
I am trying to put a button in a special x and y values. Is it possible in Metro C # (Windows Store app)
You have two main options and one Less is obvious.
-
If your button is in a
canvas
panel - then you canCanvas.X
andCanvas.Y
can set the attribute properties on the button, the desired value. -
If your button is in default 1x1 cell
grid
- you canhorizontal alignment = "left" vertical alignment = "set" heading "Margin =" 10,20,0,0 "
where 10 and 20 x and y values are. -
If you want to animate the coordinates (one With button is not normal, but who am I to judge) - It is best to use a
RenderTransform
to create this situation, you give it the original coordinates of 0,0 You can set using one of the earlier methods, settranslateTransform
to setRenderTransform
and set the transform codeX
Andy
Properties for the desired values This idea is that the properties ofRenderTransform
can be easily animated, whileCanvas.X / Y
ormargins
are not property because they affect layout and layout calculation is slow.
Comments
Post a Comment