Example #1
0
        public static void Initialize(this AView platformView, IView view)
        {
            var pivotX = (float)(view.AnchorX * platformView.ToPixels(view.Frame.Width));
            var pivotY = (float)(view.AnchorY * platformView.ToPixels(view.Frame.Height));
            int visibility;

            if (view is IActivityIndicator a)
            {
                visibility = (int)a.GetActivityIndicatorVisibility();
            }
            else
            {
                visibility = (int)view.Visibility.ToPlatformVisibility();
            }

            // NOTE: use named arguments for clarity
            PlatformInterop.Set(platformView,
                                visibility: visibility,
                                layoutDirection: (int)GetLayoutDirection(view),
                                minimumHeight: (int)platformView.ToPixels(view.MinimumHeight),
                                minimumWidth: (int)platformView.ToPixels(view.MinimumWidth),
                                enabled: view.IsEnabled,
                                alpha: (float)view.Opacity,
                                translationX: platformView.ToPixels(view.TranslationX),
                                translationY: platformView.ToPixels(view.TranslationY),
                                scaleX: (float)(view.Scale * view.ScaleX),
                                scaleY: (float)(view.Scale * view.ScaleY),
                                rotation: (float)view.Rotation,
                                rotationX: (float)view.RotationX,
                                rotationY: (float)view.RotationY,
                                pivotX: pivotX,
                                pivotY: pivotY
                                );
        }