• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.VisualElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetServicesPage

        /// <summary>
        /// Gets the services page.
        /// </summary>
        /// <param name="mainPage">The main page.</param>
        /// <returns>Content Page.</returns>
        private static ContentPage GetServicesPage(VisualElement mainPage)
        {
            var services = new ContentPage { Title = "Services" };
            var lstServices = new ListView
            {
                ItemsSource = new List<string>() {
                    "TextToSpeech",
                    "DeviceExtended",
                    "PhoneService",
                    "GeoLocator",
                    "Camera",
                    "Accelerometer",
                    "Display",
                    "Cache",
                    "Sound"
                }
            };

            lstServices.ItemSelected += async (sender, e) =>
            {
                switch (e.SelectedItem.ToString().ToLower())
                {
                    case "texttospeech":
                        await mainPage.Navigation.PushAsync(new TextToSpeechPage());
                        break;
                    case "deviceextended":
                        await mainPage.Navigation.PushAsync(new ExtendedDeviceInfoPage(Resolver.Resolve<IDevice>()));
                        break;
                    case "phoneservice":
                        await mainPage.Navigation.PushAsync(new PhoneServicePage());
                        break;
                    case "geolocator":
                        await mainPage.Navigation.PushAsync(ViewFactory.CreatePage<GeolocatorViewModel>());
                        break;
                    case "camera":
                        await mainPage.Navigation.PushAsync(ViewFactory.CreatePage<CameraViewModel>());
                        break;
                    case "accelerometer":
                        await mainPage.Navigation.PushAsync(new AcceleratorSensorPage());
                        break;
                    case "display":
                        await mainPage.Navigation.PushAsync(new AbsoluteLayoutWithDisplayInfoPage(Resolver.Resolve<IDisplay>()));
                        break;
                    case "cache":
                        await mainPage.Navigation.PushAsync(ViewFactory.CreatePage<CacheServiceViewModel>());
                        break;
                    case "sound":
                        await mainPage.Navigation.PushAsync(ViewFactory.CreatePage<SoundServiceViewModel>());
                        break;
                    default:
                        break;
                }
            };
            services.Content = lstServices;
            return services;
        }
开发者ID:jesusgarza,项目名称:Xamarin-Forms-Labs-Samples,代码行数:61,代码来源:App.cs


示例17: 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 thirdActivity = new Intent (activity, typeof (MyThirdActivity));
            activity.StartActivity (thirdActivity);
        }
开发者ID:Biotelligent,项目名称:xamarin-forms-samples,代码行数:10,代码来源:MyThirdPageRenderer.cs


示例18: GetOrCreateRenderer

 /// <summary>
 /// Gets the or create renderer.
 /// </summary>
 /// <returns>The or create renderer.</returns>
 /// <param name="source">Source.</param>
 public static IVisualElementRenderer GetOrCreateRenderer(VisualElement source)
 {
     var renderer = RendererHelper.GetRenderer (source);
     if (renderer == null) {
         renderer = RendererFactory.GetRenderer (source);
         RendererHelper.SetRenderer (source, renderer);
         renderer = RendererHelper.GetRenderer (source);
     }
     return renderer;
 }
开发者ID:Pizzajongen,项目名称:TwinTechsFormsLib,代码行数:15,代码来源:RendererHelper.cs


示例19: GetControlsPage

 /// <summary>
 /// Gets the controls page.
 /// </summary>
 /// <param name="mainPage">The main page.</param>
 /// <returns>Content Page.</returns>
 private static ContentPage GetControlsPage(VisualElement mainPage)
 {
     var controls = new ContentPage { Title = "Controls" };
     var lstControls = new ListView
     {
         ItemsSource = new List<string>()
         {
             "Calendar",
             "Autocomplete",
             "Buttons",
             "Labels",
             "Cells",
             "HybridWebView",
             "WebImage",
             "DynamicListView"
         }
     };
     lstControls.ItemSelected += async (sender, e) =>
     {
         switch (e.SelectedItem.ToString().ToLower())
         {
             case "calendar":
                 await mainPage.Navigation.PushAsync(new CalendarPage());
                 break;
             case "autocomplete":
                 await mainPage.Navigation.PushAsync(new AutoCompletePage());
                 break;
             case "buttons":
                 await mainPage.Navigation.PushAsync(new ButtonPage());
                 break;
             case "labels":
                 await mainPage.Navigation.PushAsync(new ExtendedLabelPage());
                 break;
             case "cells":
                 await mainPage.Navigation.PushAsync(new ExtendedCellPage());
                 break;
             case "hybridwebview":
                 await mainPage.Navigation.PushAsync(new CanvasWebHybrid());
                 break;
             case "webimage":
                 await mainPage.Navigation.PushAsync(new WebImagePage());
                 break;
             case "dynamiclistview":
                 await mainPage.Navigation.PushAsync(new Xamarin.Forms.Labs.Sample.Pages.Controls.DynamicList.DynamicListView());
                 break;
             default:
                 break;
         }
     };
     controls.Content = lstControls;
     return controls;
 }
开发者ID:WillooWisp,项目名称:Xamarin-Forms-Labs,代码行数:57,代码来源:App.cs


示例20: OnModelSet

		protected override void OnModelSet (VisualElement model)
		{
			_view = (CalendarView)model;
			base.OnModelSet (model);

			var calendarView = new CalendarMonthView(DateTime.Now, true);

			calendarView.OnDateSelected += (date) => {
				_view.NotifyDateSelected(date);
			};

			base.SetNativeControl (calendarView);
		}			
开发者ID:Bonelol,项目名称:Xamarin.Forms.Calendar,代码行数:13,代码来源:CalendarViewRenderer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Layout.LayoutAnchorable类代码示例发布时间:2022-05-26
下一篇:
C# Forms.View类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap