コード例 #1
0
 private void SetIsBusy()
 {
     if (Element.ShowIsBusyDialog && Element.Parent is NavigationPage navpg)
     {
         (XPlatform.GetRenderer(navpg) as NavigationRenderer).SetIsBusy(Element.IsBusy);
     }
 }
コード例 #2
0
        public System.Drawing.PointF GetCoordinates(global::Xamarin.Forms.VisualElement element)
        {
            var renderer   = XFPlatform.GetRenderer(element);
            var nativeView = renderer.View;
            var location   = new int[2];
            var density    = nativeView.Context.Resources.DisplayMetrics.Density;

            nativeView.GetLocationOnScreen(location);
            var coord = new System.Drawing.PointF(location[0] / density, location[1] / density);

            //Something is wrong with the calculation and must be adjusted by 91.5
            coord.Y = coord.Y - 80.2f;

            return(coord);
        }
コード例 #3
0
        public static AViews.View ToAndroid(this Xamarin.Forms.View view)
        {
            if (APlatform.GetRenderer(view) == null)
            {
                APlatform.SetRenderer(view, APlatform.CreateRendererWithContext(view, Application.Context));
            }
            var vRenderer = APlatform.GetRenderer(view);
            var viewGroup = vRenderer.View;

            vRenderer.Tracker.UpdateLayout();
            var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);

            viewGroup.LayoutParameters = layoutParams;
            viewGroup.Layout(0, 0, (int)view.WidthRequest, (int)view.HeightRequest);
            return(viewGroup);
        }