static Transform WrapDpiTransform(Transform origTransform, double dpiScaleFactor) { var group = new TransformGroup(); if (origTransform != null) { group.Children.Add(origTransform); } group.Children.Add(new ScaleTransform(dpiScaleFactor, dpiScaleFactor)); UIHooks.SetIsDpiTransform(group, true); return(group); }
static Transform UnwrapDpiTransform(Transform currentTransform) { if (currentTransform != null && UIHooks.GetIsDpiTransform(currentTransform)) { var group = currentTransform as TransformGroup; if (group != null && group.Children.Count > 1) { return(group.Children[0]); } return(null); } return(currentTransform); }