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


C# RelativeLayout.FadeTo方法代码示例

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


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

示例1: ShowPopup

        /// <summary>
        ///     Show a view as
        /// </summary>
        /// <param name="view">The view to be displayed as popup</param>
        /// <returns>
        /// </returns>
        /// <exception cref="System.ArgumentNullException">The <paramref name="view" /> is <c>null</c>.</exception>
        public async Task<bool> ShowPopup(View view)
        {
            Argument.IsNotNull(() => view);

            await DismissPopup();

            _popupView = view;
            _content.InputTransparent = true;
            var backdrop = new RelativeLayout
            {
                BackgroundColor = Color.FromRgba(0, 0, 0, 0.4),
                Opacity = 1,
                GestureRecognizers =
                {
                    new TapGestureRecognizer()
                }
            };

            if (_popupView.BackgroundColor == Color.Default)
            {
                _popupView.BackgroundColor = Color.FromRgb(40, 40, 40);
            }

            if (_popupView.WidthRequest < 0)
            {
                _popupView.WidthRequest = Width;
            }

            if (_popupView.HeightRequest < 0)
            {
                _popupView.HeightRequest = Height;
            }

            backdrop.Children.Add(_popupView,
                Constraint.RelativeToParent(p => Width/2 - _popupView.WidthRequest/2),
                Constraint.RelativeToParent(p => Height/2 - _popupView.HeightRequest/2),
                Constraint.RelativeToParent(p => _popupView.WidthRequest),
                Constraint.RelativeToParent(p => _popupView.HeightRequest));

            _backdrop = backdrop;

            Children.Add(backdrop, Constraint.Constant(0), Constraint.Constant(0),
                Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height));

            UpdateChildrenLayout();

            return await _backdrop.FadeTo(1);
        }
开发者ID:Catel,项目名称:Catel,代码行数:55,代码来源:PopupLayout.cs


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