当前位置: 首页>>代码示例>>C#>>正文


C# Xamarin.GetRenderer方法代码示例

本文整理汇总了C#中Xamarin.GetRenderer方法的典型用法代码示例。如果您正苦于以下问题:C# Xamarin.GetRenderer方法的具体用法?C# Xamarin.GetRenderer怎么用?C# Xamarin.GetRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xamarin的用法示例。


在下文中一共展示了Xamarin.GetRenderer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToggleViewShadow

		public void ToggleViewShadow (Xamarin.Forms.View view, bool isOn)
		{
			var renderer = view.GetRenderer ();
			var nativeView = renderer.NativeView;
			nativeView.Layer.ShadowColor = UIColor.Black.CGColor;
			nativeView.Layer.ShadowOpacity = isOn ? 1 : 0;
			nativeView.Layer.ShadowOffset = isOn ? new CGSize (10, 10) : CGSize.Empty;
		}
开发者ID:DevinvN,项目名称:TwinTechsFormsLib,代码行数:8,代码来源:ViewMaskExtensionProvider.cs

示例2: NativeGestureCoordinator

		public NativeGestureCoordinator (Xamarin.Forms.View targetView)
		{
			NativeRecognizers = new List<BaseNativeGestureRecognizer> ();
			TargetView = targetView;
			TargetView.InputTransparent = false;
			var renderer = TargetView.GetRenderer ();
			if (renderer == null) {
				TargetView.PropertyChanged += Recognizer_View_PropertyChanged;
			} else {
				Initialize ();
			}
		}
开发者ID:DevinvN,项目名称:TwinTechsFormsLib,代码行数:12,代码来源:NativeGestureCoordinator.cs

示例3: ApplyMaskToView

		public void ApplyMaskToView (Xamarin.Forms.View view, ViewMaskerType maskType)
		{
			var renderer = view.GetRenderer ();
			var nativeView = renderer.NativeView;
			if (maskType == ViewMaskerType.None) {
				view.SizeChanged -= OnSizeChanged;
				nativeView.Layer.Mask = null;
			} else {
				var maskLayer = GetMaskShape (maskType, new Xamarin.Forms.Size (view.Width, view.Height));
				maskLayer.Frame = nativeView.Bounds;
				nativeView.Layer.Mask = maskLayer;
				view.SizeChanged += OnSizeChanged;
			}
			nativeView.Tag = (int)maskType;
			
		}
开发者ID:DevinvN,项目名称:TwinTechsFormsLib,代码行数:16,代码来源:ViewMaskExtensionProvider.cs

示例4: CustomDialog

        public CustomDialog(Xamarin.Forms.View content, bool _cancelable = false)
        {
            cancelable = _cancelable;
            nativePopup = new System.Windows.Controls.Primitives.Popup();
            nativePopup.VerticalOffset = 0;
            nativePopup.HorizontalOffset = 0;

            System.Windows.Controls.Grid wrap = new System.Windows.Controls.Grid();
            var ScreenWidth = System.Windows.Application.Current.Host.Content.ActualWidth;
            var ScreenHeight = System.Windows.Application.Current.Host.Content.ActualHeight;
            wrap.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(50, 50, 50, 50));

            wrap.Height = XFPopupConst.SCREEN_HEIGHT;
            wrap.Width = XFPopupConst.SCREEN_WIDTH;

            wrap.MouseLeftButtonUp += (s, e) => {
                if (cancelable)
                {
                    nativePopup.IsOpen = false;
                }
            };

            var boder = new Border();
            boder.BorderThickness = new System.Windows.Thickness(1);
            boder.Padding = new System.Windows.Thickness(5);
            boder.BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 50, 50, 50));
            boder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));

            boder.VerticalAlignment = VerticalAlignment.Center;
            boder.HorizontalAlignment = HorizontalAlignment.Center;

            boder.Width = content.WidthRequest + 10;
            boder.Height = content.HeightRequest + 10;
            boder.CornerRadius = new CornerRadius(5);

            var elm = (content.GetRenderer() as Panel);
            elm.VerticalAlignment = VerticalAlignment.Top;
            elm.HorizontalAlignment = HorizontalAlignment.Left;
            boder.Child = elm;

            wrap.Children.Add(boder);
            nativePopup.Child = wrap;
            nativePopup.IsOpen = false;
        }
开发者ID:thaihung203,项目名称:xfpopup,代码行数:44,代码来源:WPXFPopupSrvc.cs

示例5: GetLocationInAncestorView

		protected Xamarin.Forms.Point GetLocationInAncestorView (Xamarin.Forms.Point location, Xamarin.Forms.VisualElement view)
		{
			int[] nativeViewLocation = new int[2];
			NativeView.GetLocationOnScreen (nativeViewLocation);
			var nativeViewLocationOnScreen = new Xamarin.Forms.Point (nativeViewLocation [0], nativeViewLocation [1]);

			var offsetLocation = new Xamarin.Forms.Point (location.X + nativeViewLocationOnScreen.X, location.Y + nativeViewLocationOnScreen.Y);

			var targetViewRenderer = view.GetRenderer ();
			var targetView = targetViewRenderer.ViewGroup;
			int[] targetViewLocation = new int[2];
			targetView.GetLocationOnScreen (targetViewLocation);
			var nativeViewScreenLocation = new Xamarin.Forms.Point (targetViewLocation [0], targetViewLocation [1]);

			var returnPoint = offsetLocation;
			returnPoint.X -= nativeViewScreenLocation.X;
			returnPoint.Y -= nativeViewScreenLocation.Y;

//			Console.WriteLine ("offsetLocation {0} nativeViewLocationOnScreen {1} returnPoint", offsetLocation, nativeViewLocationOnScreen);
//			Console.WriteLine ("location {0} parentViewLoc {1} returnPoint {2}", location, nativeViewScreenLocation, returnPoint);
			return returnPoint;
		}
开发者ID:DevinvN,项目名称:TwinTechsFormsLib,代码行数:22,代码来源:BaseNativeGestureRecognizer.cs

示例6: ShowTopNoti

        public void ShowTopNoti(Xamarin.Forms.Page p, View noti, int msTTL = 1500)
        {
            var render = Convert(noti, p);

            if (render != null)
            {
                var nanchor = p.GetRenderer() as Canvas;
                p.WidthRequest = nanchor.ActualWidth - 10;

                if (noti.HeightRequest <= 0)
                {
                    var size = noti.GetSizeRequest(nanchor.ActualWidth - 10, XFPopupConst.SCREEN_HEIGHT / 2);
                    if (size.Request.Height > XFPopupConst.SCREEN_HEIGHT / 2)
                    {
                        noti.HeightRequest = XFPopupConst.SCREEN_HEIGHT / 2;
                    }
                    else
                    {
                        noti.HeightRequest = size.Request.Height;
                    }
                }

                noti.Layout(new Rectangle(0, 0, noti.WidthRequest, noti.HeightRequest));

                var nativePopup = new System.Windows.Controls.Primitives.Popup();
                nativePopup.VerticalOffset = 0;
                nativePopup.HorizontalOffset = 0;

                var boder = new Border();
                boder.BorderThickness = new System.Windows.Thickness(1);
                boder.Padding = new System.Windows.Thickness(5);
                boder.BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 50, 50, 50));
                boder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));

                boder.VerticalAlignment = VerticalAlignment.Top;
                boder.HorizontalAlignment = HorizontalAlignment.Stretch;

                boder.Width = noti.WidthRequest + 10;
                boder.Height = noti.HeightRequest + 10;
                boder.CornerRadius = new CornerRadius(5);

                var elm = (render as Panel);
                elm.VerticalAlignment = VerticalAlignment.Top;
                elm.HorizontalAlignment = HorizontalAlignment.Left;
                boder.Child = elm;

                nativePopup.Child = boder;
                nativePopup.IsOpen = true;

                //
                byte count = 0;
                var dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
                dispatcherTimer.Tick += (object sender, EventArgs e) => {
                    count++;
                    if (count >= 10) {
                        dispatcherTimer.Stop();
                        nativePopup.IsOpen = false;

                    }

                    boder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)(255 - count * 25), 255, 255, 255));
                };

                dispatcherTimer.Interval = new TimeSpan(0, 0, 0,msTTL/10);
                dispatcherTimer.Start();
            }
        }
开发者ID:thaihung203,项目名称:xfpopup,代码行数:67,代码来源:WPXFPopupSrvc.cs

示例7: Convert

        public IVisualElementRenderer Convert(Xamarin.Forms.View source, Xamarin.Forms.VisualElement valid)
        {
            //only wp allow us to get renderer directly
            IVisualElementRenderer render = source.GetRenderer();
            if (render == null)
            {
                render = RendererFactory.GetRenderer(source);
                source.SetRenderer(render);
                if (valid != null)
                {
                    var p = PlatformProperty.GetValue(valid);
                    if (p != null)
                    {
                        PlatformProperty.SetValue(source, p);
                        IsPlatformEnabledProperty.SetValue(source, true);
                    }
                }
            }

            return render;
        }
开发者ID:thaihung203,项目名称:xfpopup,代码行数:21,代码来源:WPXFPopupSrvc.cs

示例8: GetLocationInAncestorView

 protected Xamarin.Forms.Point GetLocationInAncestorView(Xamarin.Forms.Point location, Xamarin.Forms.VisualElement view)
 {
     var targetViewRenderer = view.GetRenderer ();
     var targetView = targetViewRenderer.ViewGroup;
     var parent = NativeView;
     var returnPoint = location;
     while (parent != null && parent != targetView) {
         returnPoint.X += parent.Left;
         returnPoint.Y += parent.Top;
         parent = NativeView.Parent as View;
     }
     return returnPoint;
 }
开发者ID:xamarin-libraries,项目名称:TwinTechsFormsLib,代码行数:13,代码来源:BaseNativeGestureRecognizer.cs


注:本文中的Xamarin.GetRenderer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。