silverlight - WPF: Can I get the size of a UIElement AFTER a transform is applied? -


In WPF / Silverlight, I can get the calculated value of UIElement after the conversion is applied Am I

(As per the comment below):

I have a stack panel and I have applied it to TranformGroup .

  groupTransform.children.add (new translation transform ());  

(warning, further psuedo code)

  There are two translations and a scale change in the group. GroupTransform.children.add (new scale transforms ()); GroupTransform.children.add (new translation transform ()); ContainerToScale.RenderTransform = groupTransform; ... // code which sets the value for all changes  

Obviously the scale is the one which is the most interested in me.

realism and actual height changes you do not make changes . After calculating the size of the control of the layout system, the real height and actual height reflect the calculated width / height (depending on the values ​​like margins , horizontal alignment , etc.)

One way of achieving the size of the control, keeping in mind all the visible changes, which is to run the visible tree and all the values ​​are Actual Wide and Real Control Apply in Control:

  Public static size GetActualSize (framework element control) {size startSize = new size (control actual wide, control realheit); // Root Basic Mother = LogicTreeHelper until parents reach the root of the tree. Gatepaint (control); While (Parents! = Faucet & Parenwork as FrameworkElement! = Tap & Parents. GetType ()! = Typeof (window)) {// Try to change to a scale FrameworkElement fp = parentworkElement As parents; Scale Transform Scale = SearchScottel Transforms (FPR Readersform); If (scale! = Null) {startSize.Width * = scale.ScaleX; StartSize.Highlight * = scale.ScaleY; } Parent = LogicTreeHelper.GatePant (Parent); // Return to the new size of return; } Public Static Scale Transform Search Skystorms (Transform Hotstocks) {If (Hack Stack Scale Transform) {Return (Scale Transform) Huststack; } If (Stacks Transform Group) {transform group group = Haystack as transform group; Foreign children (different children in the group) children (if children are scale transforms) {return (scale transformer) children; }}} Return tap; }  

Keep in mind that if your visual tree is deep or you perform several times this time it may be ineligible. In practice I never run into any problems with it, though.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -