CK.WindowManager.Model.BindingExtensions.GetWindowArea C# (CSharp) Method

GetWindowArea() public static method

Gets the window area of the IBinding.Origin window comparing to the IBinding.Target and IBinding.BindingPosition.
public static GetWindowArea ( this binding ) : Rect
binding this
return System.Windows.Rect
        public static Rect GetWindowArea( this IBinding binding )
        {
            if( binding.Position == BindingPosition.Top )
            {
                double top = binding.Target.Top - binding.Origin.Height;
                double left = binding.Target.Left;
                double width = binding.Target.Width;
                double height = binding.Origin.Height;
                return new Rect( left, top, width, height );
            }
            if( binding.Position == BindingPosition.Bottom )
            {
                double top = binding.Target.Top + binding.Target.Height;
                double left = binding.Target.Left;
                double width = binding.Target.Width;
                double height = binding.Origin.Height;
                return new Rect( left, top, width, height );
            }
            if( binding.Position == BindingPosition.Left )
            {
                double top = binding.Target.Top;
                double left = binding.Target.Left - binding.Origin.Width;
                double width = binding.Origin.Width;
                double height = binding.Target.Height;
                return new Rect( left, top, width, height );
            }
            if( binding.Position == BindingPosition.Right )
            {
                double top = binding.Target.Top;
                double left = binding.Target.Left + binding.Target.Width;
                double width = binding.Origin.Width;
                double height = binding.Target.Height;
                return new Rect( left, top, width, height );
            }
            return Rect.Empty;
        }