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


C# Xamarin.GetValue方法代码示例

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


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

示例1: Convert

        public IVisualElementRenderer Convert(Xamarin.Forms.View source, Xamarin.Forms.VisualElement valid)
        {
            IVisualElementRenderer render = (IVisualElementRenderer)source.GetValue(RendererProperty);
            if (render == null)
            {
                render = RendererFactory.GetRenderer(source);
                source.SetValue(RendererProperty, 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,代码行数:20,代码来源:DroidXFPopupSrvc.cs

示例2: CreateDropDown

        public IXFPopupCtrl CreateDropDown(Xamarin.Forms.View anchor, Xamarin.Forms.View drop)
        {
            CustomPopup dlg = null;
            //first try to get the PopupHolderRenderer
            //first try to get the PopupHolderRenderer
            if(anchor == null || drop == null){
                return null;
            }

            var anchorRender = anchor.GetValue(RendererProperty) as UIView;
            if (anchorRender == null) {
                return null;
            }

            var render = Convert(drop, anchor);

            if (render == null) {
                return null;
            }

            if (render != null) {

                var size = drop.GetSizeRequest(anchorRender.Bounds.Width, XFPopupConst.SCREEN_HEIGHT);
                var width = anchorRender.Bounds.Width;
                var height = (int)size.Request.Height;
                if (height > (XFPopupConst.SCREEN_HEIGHT * 3/ 4))
                {
                    height = (int)(XFPopupConst.SCREEN_HEIGHT * 3/ 4);
                }

                //important
                drop.Layout(new Xamarin.Forms.Rectangle(0, 0, width - 2*padding, height));

                var native = render as UIKit.UIView;
                native.Frame = new CoreGraphics.CGRect (padding, padding, width - 2*padding, height);

                dlg = new CustomPopup(native, true, width, height + 2*padding, ShowType.DropDown,anchorRender);

            }
            return dlg;
        }
开发者ID:thaihung203,项目名称:xfpopup,代码行数:41,代码来源:IosXFPopupSrvc.cs

示例3: CreateDropDown

        public IXFPopupCtrl CreateDropDown(Xamarin.Forms.View anchor, Xamarin.Forms.View drop)
        {
            CustomDropDown dropctr = null;
            //get the renderer of anchor
            if (anchor != null) {
                var ar = anchor.GetValue(RendererProperty);
                if (ar != null) {
                    var dropView = Convert(drop, anchor);

                    if (dropView == null) {
                        return null;
                    }

                    double w = (int)anchor.Width;
                    double h = XFPopupConst.SCREEN_HEIGHT/2;
                    drop.WidthRequest = w;
                    var size = drop.GetSizeRequest(w, XFPopupConst.SCREEN_HEIGHT / 2);
                    if (size.Request.Height < h) {
                        h = size.Request.Height;
                    }

                    drop.Layout(new Rectangle(0, 0, w, h));

                    float density = Forms.Context.Resources.DisplayMetrics.Density;
                    w = w * density;
                    h = h * density;

                    var native = dropView as Android.Views.View;
                    native.LayoutParameters = new ViewGroup.LayoutParams((int)w, (int)h);

                    dropctr = new CustomDropDown(ar as Android.Views.View, native, (int)w + 4, (int)h+10);

                }

            }

            return dropctr;
        }
开发者ID:thaihung203,项目名称:xfpopup,代码行数:38,代码来源:DroidXFPopupSrvc.cs


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