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


C# Forms.VisualElement类代码示例

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


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

示例1: OnModelChanged

        protected override void OnModelChanged(VisualElement oldModel, VisualElement newModel)
        {
            base.OnModelChanged(oldModel, newModel);

            // this is a ViewGroup - so should be able to load an AXML file and FindView<>
            var activity = this.Context as Activity;

            var auth = new OAuth2Authenticator(
                clientId: "574134802616730", // your OAuth2 client id
                scope: "email,user_about_me", // the scopes for the particular API you're accessing, delimited by "+" symbols
                authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"), // the auth URL for the service
                redirectUrl: new Uri("https://www.cautom.com/SocialAuth/FBLogin/")); // the redirect URL for the service

            auth.Completed += (sender, eventArgs) =>
            {
                if (eventArgs.IsAuthenticated)
                {
                    //App.SuccessfulLoginAction.Invoke();
                    // Use eventArgs.Account to do wonderful things
                    //App.SaveToken(eventArgs.Account.Properties["access_token"]);
                    string accessToken = eventArgs.Account.Properties["access_token"];
                    new FacebookLoginWebView().fetchUserInfoFromAccessToken(accessToken);
                }
                else
                {
                    // The user cancelled
                }
            };

            activity.StartActivity(auth.GetUI(activity));
        }
开发者ID:getsaurabh02,项目名称:M2EMobile,代码行数:31,代码来源:LoginPageRenderer.cs

示例2: OnElementChanged

        protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement)
        {
            base.OnElementChanged(oldElement, newElement);

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= this.HandleMasterDetailPagePropertyChanged;
                oldElement.PropertyChanging -= this.HandleMasterDetailPagePropertyChanging;
            }

            if (newElement != null)
            {
                newElement.PropertyChanged += this.HandleMasterDetailPagePropertyChanged;
                newElement.PropertyChanging += this.HandleMasterDetailPagePropertyChanging;
            }

            if (oldElement == null && newElement != null)
            {
                this.SetFitsSystemWindows(true);

                var activity = (Activity)this.Context;

                this.actionBarDrawerToggle = new CustomActionBarDrawerToggle(this, activity, this) { DrawerIndicatorEnabled = true };

                this.ActionBar.SetDisplayHomeAsUpEnabled(true);
                this.ActionBar.SetHomeButtonEnabled(true);

                this.actionBarDrawerToggle.SyncState();

                this.BindNavigationEventHandlers();
            }
        }
开发者ID:jdluzen,项目名称:oss-xamarin,代码行数:32,代码来源:AppCompatMasterDetailRenderer.cs

示例3: OnModelChanged

		protected override void OnModelChanged (VisualElement oldModel, VisualElement newModel)
		{
			base.OnModelChanged (oldModel, newModel);

			// this is a ViewGroup - so should be able to load an AXML file and FindView<>
			var activity = this.Context as Activity;

			var auth = new OAuth2Authenticator (
				clientId: App.Instance.OAuthSettings.ClientId, // your OAuth2 client id
				scope: App.Instance.OAuthSettings.Scope, // The scopes for the particular API you're accessing. The format for this will vary by API.
				authorizeUrl: new Uri (App.Instance.OAuthSettings.AuthorizeUrl), // the auth URL for the service
				redirectUrl: new Uri (App.Instance.OAuthSettings.RedirectUrl)); // the redirect URL for the service

			auth.Completed += (sender, eventArgs) => {
				if (eventArgs.IsAuthenticated) {
					App.Instance.SuccessfulLoginAction.Invoke();
					// Use eventArgs.Account to do wonderful things
					App.Instance.SaveToken(eventArgs.Account.Properties["access_token"]);
				} else {
					// The user cancelled
				}
			};

			activity.StartActivity (auth.GetUI(activity));
		}
开发者ID:Gunner92,项目名称:OAuthTwoDemo.XForms,代码行数:25,代码来源:LoginPageRenderer.cs

示例4: SetElement

        public void SetElement(VisualElement element)
        {
            var oldElement = this.Element;

            if (oldElement != null)
                oldElement.PropertyChanged -= HandlePropertyChanged;

            this.Element = element;
            if (this.Element != null)
            {

                this.Element.PropertyChanged += HandlePropertyChanged;
            }

            ViewGroup.RemoveAllViews();
            Tracker = new VisualElementTracker(this);

            Packager = new VisualElementPackager(this);
            Packager.Load();

            UseCompatPadding = true;

            SetContentPadding((int)TheView.Padding.Left, (int)TheView.Padding.Top,
                   (int)TheView.Padding.Right, (int)TheView.Padding.Bottom);

            Radius = TheView.CornerRadius;
            SetCardBackgroundColor(TheView.BackgroundColor.ToAndroid());

            if (ElementChanged != null)
                ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
        }
开发者ID:cesartomatis,项目名称:Xamarin-Forms-CardView,代码行数:31,代码来源:AndroidCustomCardRenderer.cs

示例5: SetElement

        /// <summary>
        /// Setup our SwipeRefreshLayout and register for property changed notifications.
        /// </summary>
        /// <param name="element">Element.</param>
        public void SetElement(VisualElement element)
        {
            var oldElement = Element;

            //unregister old and re-register new
            if (oldElement != null)
                oldElement.PropertyChanged -= HandlePropertyChanged;

            Element = element;
            if (Element != null)
            {
                UpdateContent();
                Element.PropertyChanged += HandlePropertyChanged;
            }

            if (!init)
            {
                init = true;
                //sizes to match the forms view
                //updates properties, handles visual element properties
                Tracker = new VisualElementTracker(this);
                SetOnRefreshListener(this);
            }

            UpdateColors();
            UpdateIsRefreshing();
            UpdateIsSwipeToRefreshEnabled();

            if (ElementChanged != null)
                ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
        }
开发者ID:cleardemon,项目名称:Xamarin.Forms-PullToRefreshLayout,代码行数:35,代码来源:PullToRefreshLayoutRenderer.cs

示例6: Invoke

 async protected override void Invoke(VisualElement visual)
 {
     visual.AnchorX = Anchor.X;
     visual.AnchorY = Anchor.Y;
     await Task.Delay(Delay);
     await visual.ScaleTo(Scale, (uint)Length, Easing);
 }
开发者ID:jenart,项目名称:xamarin-forms-book-preview-2,代码行数:7,代码来源:DelayedScaleAction.cs

示例7: SetElement

        public void SetElement(VisualElement element)
        {
            var oldElement = this.Element;

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= this.HandlePropertyChanged;
            }

            this.Element = element;

            if (this.Element != null)
            {
                this.Element.PropertyChanged += this.HandlePropertyChanged;
            }

            this.RemoveAllSubviews();
            this.Tracker = new VisualElementTracker(this);

            this.Packager = new VisualElementPackager(this);
            this.Packager.Load();

            this.SetContentPadding((int)TheView.Padding.Left, (int)TheView.Padding.Top, (int)TheView.Padding.Right, (int)TheView.Padding.Bottom);

            this.SetCardBackgroundColor(this.TheView.BackgroundColor.ToUIColor());

            if (ElementChanged != null)
            {
                this.ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
            }
        }
开发者ID:cesartomatis,项目名称:Xamarin-Forms-CardView,代码行数:31,代码来源:AppleCustomCardRenderer.cs

示例8: SetElement

        public void SetElement(VisualElement element)
        {
            var oldElement = this.Element;

            if (oldElement != null)
            {
                this.HookPropertyChanged(oldElement);
            }

            if (oldElement == null)
            {
                this.Element = element;
                this.UnhookPropertyChanged(this.Element);
                this.Tracker = new VisualElementTracker(this);

                if (this.Control == null)
                {
                    this.Control = this.CreateFloatingActionButton();
                    this.Control.Clickable = true;
                    this.Control.SetOnClickListener(new OnClickListener(x => this.FloatingButton.ExecuteCommand()));

                    this.UpdateColorState();
                    this.UpdateIcon();
                }

                this.AddView(this.Control);
            }

            this.OnElementChanged(new VisualElementChangedEventArgs(oldElement, this.Element));
        }
开发者ID:jdluzen,项目名称:oss-xamarin,代码行数:30,代码来源:FloatingButtonRenderer.cs

示例9: SetElement

        public void SetElement(VisualElement element)
        {
            var oldElement = this.Element;

            if (oldElement != null)
                oldElement.PropertyChanged -= HandlePropertyChanged;

            this.Element = element;
            if (this.Element != null) {
                //UpdateContent ();
                this.Element.PropertyChanged += HandlePropertyChanged;
            }

            this.ViewGroup.RemoveAllViews ();
            //sizes to match the forms view
            //updates properties, handles visual element properties
            this.Tracker = new VisualElementTracker (this);

            this.Packager = new VisualElementPackager (this);
            this.Packager.Load ();

            this.UseCompatPadding = true;

            this.SetContentPadding ((int)TheView.Padding.Left, (int)TheView.Padding.Top, (int)TheView.Padding.Right, (int)TheView.Padding.Bottom);

            this.Radius = TheView.CornderRadius;

            this.SetCardBackgroundColor(TheView.BackgroundColor.ToAndroid ());
            if (this.ElementChanged != null)
            {
                this.ElementChanged(this, new VisualElementChangedEventArgs(oldElement, this.Element));
            }
        }
开发者ID:harrysaggu,项目名称:xamarin-plugins,代码行数:33,代码来源:CardViewRenderer.cs

示例10: LayoutOperation

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="element">The element that caused the layout operation.</param>
 /// <param name="other">The list of other elements that were affected by the operation.</param>
 /// <param name="direction">The direction that the layout should be performed in.</param>
 /// <param name="value">The value that the elements will be affected by in the layout direction.</param>
 internal LayoutOperation(VisualElement element, IEnumerable<VisualElement> other, LayoutDirection direction, double value)
 {
     RootElement = element;
     Elements = new [] { element }.Union(other).ToList();
     Direction = direction;
     Value = value;
 }
开发者ID:cosullivan,项目名称:Xamarin.FormsEx,代码行数:14,代码来源:LayoutOperation.cs

示例11: AdaptForBinding

 public static void AdaptForBinding(VisualElement element, IMvxBindingContextOwner contextOwner)
 {
     var mvxPage = element as IMvxContentPage;
     if (mvxPage != null) {
         contextOwner.BindingContext = new MvxBindingContext();
         contextOwner.BindingContext.DataContext = mvxPage.ViewModel;
     }
 }
开发者ID:martijn00,项目名称:MvvmCross-Forms,代码行数:8,代码来源:MvxPresenterHelpers.cs

示例12: OnElementChanged

        protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement) {
            base.OnElementChanged(oldElement, newElement);

            var fld = typeof(MasterDetailPageRenderer).GetField("detailLayout", BindingFlags.NonPublic | BindingFlags.Instance);
            var fldValue = fld.GetValue(this);
            var p = fld.FieldType.GetProperty("TopPadding", BindingFlags.Public | BindingFlags.Instance);
            p.SetValue(fldValue, 0);
        }
开发者ID:gruan01,项目名称:Xamarin.Form.UWPTest,代码行数:8,代码来源:MasterDetailPageRender.cs

示例13: OnModelChanged

		protected override void OnModelChanged (VisualElement oldModel, VisualElement newModel)
		{
			base.OnModelChanged (oldModel, newModel);

			var tableView = Control as global::Android.Widget.ListView;
			tableView.DividerHeight = 0;
			tableView.SetBackgroundColor (new global::Android.Graphics.Color(0x2C, 0x3E, 0x50));
		}
开发者ID:JeffHarms,项目名称:xamarin-forms-samples-1,代码行数:8,代码来源:MenuTableViewRenderer.cs

示例14: FocusEventArgs

		public FocusEventArgs(VisualElement visualElement, bool isFocused)
		{
			if (visualElement == null)
				throw new ArgumentNullException("visualElement");

			VisualElement = visualElement;
			IsFocused = isFocused;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:8,代码来源:FocusEventArgs.cs

示例15: ColorAnimation

		static Task<bool> ColorAnimation(VisualElement element, string name, Func<double, Color> transform, Action<Color> callback, uint length, Easing easing)
		{
			easing = easing ?? Easing.Linear;
			var taskCompletionSource = new TaskCompletionSource<bool>();

			element.Animate<Color>(name, transform, callback, 16, length, easing, (v, c) => taskCompletionSource.SetResult(c));
			return taskCompletionSource.Task;
		}
开发者ID:RickySan65,项目名称:xamarin-forms-samples,代码行数:8,代码来源:ViewExtensions.cs


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