开发者

Automatic translate transform with respect to borders in WPF

I need to have my TextBox translated by the vector, say X = 10, Y = 10 , when the TextBox is placed in the top left corner of my window. However, if it's situated in the right bottom corner, it should be translated by the vector X = -10, Y = -10.

I wonder, if it is possible to set the translate transform for a certain control according to its position (bottom-right/left / top-right/left) by a quick hack.

Do you have any ideas?

Cheer开发者_如何学编程s.


You need to have two property XValue and YValue, based on the orientation you need to coerce the value using CoerceValueCallback of the dependency property.

http://msdn.microsoft.com/en-us/library/system.windows.coercevaluecallback.aspx HTH

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜