SuperMap.WindowsPhone.Mapping.LayerContainer.OnBoundsChanged C# (CSharp) Method

OnBoundsChanged() private static method

private static OnBoundsChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void
d DependencyObject
e DependencyPropertyChangedEventArgs
return void
        private static void OnBoundsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d is FrameworkElement)
            {
                FrameworkElement element = (FrameworkElement)d;
                LayerContainer parent = element.Parent as LayerContainer;
                if ((parent != null) && (parent.Layer is ElementsLayer))
                {
                    Rectangle2D oldValue = (Rectangle2D)e.OldValue;
                    Rectangle2D newValue = (Rectangle2D)e.NewValue;
                    if (Rectangle2D.IsNullOrEmpty(newValue))
                    {
                        element.Visibility = Visibility.Collapsed;
                    }
                    else if (!Rectangle2D.IsNullOrEmpty(oldValue) && oldValue.Width == newValue.Width && oldValue.Height == newValue.Height)
                    {
                        parent.InvalidateArrange();
                    }
                    else
                    {
                        parent.InvalidateMeasure();
                    }
                }
            }
        }