Пример #1
0
        protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
        {
            base.OnManipulationDelta(e);
            var healthPop = e.OriginalSource as FrameworkElement;

            if (healthPop is Button)
            {
                e.Cancel();
                return;
            }
            try
            {
                if (healthPop == pop)
                {
                    var transformGroup = healthPop.RenderTransform as TransformGroup;
                    var translate      = transformGroup.Children[1] as TranslateTransform;
                    translate.X += e.DeltaManipulation.Translation.X;
                    translate.Y += e.DeltaManipulation.Translation.Y;
                    var scale = transformGroup.Children[0] as ScaleTransform;
                    scale.ScaleX *= e.DeltaManipulation.Scale.X;
                    scale.ScaleY *= e.DeltaManipulation.Scale.Y;
                }
            }
            catch (Exception)
            {
            }
        }