SilverFlow.Controls.FloatingWindow.InitializeContentRootTransformGroup C# (CSharp) Method

InitializeContentRootTransformGroup() private method

Checks the TransformGroup of the content root or creates it if necesary.
private InitializeContentRootTransformGroup ( ) : void
return void
        private void InitializeContentRootTransformGroup()
        {
            var transformGroup = contentRoot.RenderTransform as TransformGroup;
            if (transformGroup == null)
            {
                transformGroup = new TransformGroup();
                transformGroup.Children.Add(contentRoot.RenderTransform);
                contentRoot.RenderTransform = transformGroup;
            }

            // Check that ScaleTransform exists in the TransformGroup
            // ScaleTransform is used as a target in Storyboards
            var scaleTransform = transformGroup.Children.OfType<ScaleTransform>().FirstOrDefault();

            if (scaleTransform == null)
                transformGroup.Children.Insert(0, new ScaleTransform());

            var translateTransform = transformGroup.Children.OfType<TranslateTransform>().FirstOrDefault();

            if (translateTransform == null)
                transformGroup.Children.Add(new TranslateTransform());
        }
FloatingWindow