开发者

Automatic translate transform with respect to borders in WPF

开发者 https://www.devze.com 2023-01-27 08:39 出处:网络
I need to have my TextBox translated by the vector, say X = 10, Y = 10 , when theTextBox is placed in the top left corner of my window.

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

精彩评论

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