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

C# Xamarin类代码示例

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

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



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

示例1: OnElementChanged

        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged (e);

            if (e.OldElement == null && e.NewElement != null) {
                //map created the first time
                page = GetContainingPage (e.NewElement);
                navPage = (page.Parent as myNavPage);
                navPage.Popped += OnPagePopped;
                //return;
            }

            var formsMap = (ExtendedMap)Element;
            var androidMapView = (MapView)Control;

            if (myMarkers == null)
                myMarkers = new List<Marker> ();

            if (androidMapView != null && androidMapView.Map != null) {
                androidMapView.Map.InfoWindowClick += MapOnInfoWindowClick;

            }

            //if (formsMap != null) {
            //	((ObservableCollection<Pin>)formsMap.Pins).CollectionChanged += OnCollectionChanged;
            //}
        }
开发者ID:alessandrofacchini,项目名称:ImagoPCL,代码行数:27,代码来源:ExtendedMapRenderer.cs


示例2: OnElementChanged

        protected override void OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Xamarin.Forms.Button> e)
        {
            base.OnElementChanged (e);

            if (e.NewElement != null) {
                Control.TouchUpInside += delegate(object sender, EventArgs e2) {

                    var formsView = new CommonFormsView ();

                    var rect = new CGRect (0, 0, 400, 400);
                    var iOSView = FormsViewToNativeiOS.ConvertFormsToNative (formsView, rect);

                    var viewController = new UIViewController();
                    viewController.Add(iOSView);
                    viewController.View.Frame = rect;

                    var popoverController = new UIPopoverController(viewController);
                    popoverController.ContentViewController.View.BackgroundColor = viewController.View.BackgroundColor;
                    popoverController.PopoverContentSize = rect.Size;
                    var frame = UIApplication.SharedApplication.KeyWindow.RootViewController.View.Frame;
                    popoverController.PresentFromRect (Control.Frame, UIApplication.SharedApplication.KeyWindow.RootViewController.View, 0, true);

                };
            }
        }
开发者ID:berlamont,项目名称:LoadingFormsViewFromNative,代码行数:25,代码来源:NativeButtonRenderer.cs


示例3: OnElementChanged

		protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.Editor> e)
		{
			base.OnElementChanged(e);
			if (e.OldElement != null || this.Element == null)
				return;
			updateBackground();
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:7,代码来源:EditorRenderer.cs


示例4: OnElementChanged

        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged(e);

            var formsMap = (Xam.Plugin.MapExtend.Abstractions.MapExtend)Element;
            var androidMapView = (Android.Gms.Maps.MapView)Control;



            if (formsMap != null)
            {
                //((System.Collections.ObjectModel.ObservableCollection<Xamarin.Forms.Maps.Pin>)formsMap.Pins).CollectionChanged += OnPinsCollectionChanged;

                ((ObservableRangeCollection<Position>)formsMap.polilenes).CollectionChanged += OnPolCollectionChanged;

                ((ObservableRangeCollection<PinExtend>)formsMap.EPins).CollectionChanged += OnEPinCollectionChanged;

                androidMapView.Map.MarkerDragEnd += Map_MarkerDragEnd;
                androidMapView.Map.MapLongClick += (s, a) =>
                {
                    formsMap.Pins.Add(new Pin
                    {
                        Label = "Meu Endereço",
                        Position = new Position(a.Point.Latitude, a.Point.Longitude)
                    }
                    );
                };
            }
        }
开发者ID:whosol,项目名称:mapextend-plugin,代码行数:29,代码来源:MapExtendRenderer.cs


示例5: OnElementChanged

		/// <summary>
		/// Mapの生成時に呼び出される
		/// </summary>
		/// <param name="e">E.</param>
		protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<View> e)
		{
			base.OnElementChanged(e);

			if (Element == null)
				return;

			// Elementをキャストして、共通クラスで定義したMapを取得
			var formsMap = (CustomMap)Element;

			// ↑で取得したマップから、初期の中心座標を取得
			var position = formsMap.firstPosition;

			// カメラ位置(中心座標と表示領域)を設定
			var camera = CameraPosition.FromCamera(position.Latitude, position.Longitude, 10);

			// マップを作成
			var mapView = MapView.FromCamera(CoreGraphics.CGRect.Empty, camera);

			// 現在地を表示
			mapView.MyLocationEnabled = true;

			// 現在位置へ移動ボタンを表示
			mapView.Settings.MyLocationButton = true;

			// コントロールに作成したMapViewを設定
			// これにより、ここで生成したMapViewがFormsのマップの代わりに扱われるようになる
			SetNativeControl(mapView);
		}
开发者ID:mattsuDev,项目名称:Xamarin.Forms.GoogleMapSample,代码行数:33,代码来源:CustomMapRenderer.cs


示例6: OnElementChanged

        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<TimePicker> e)
        {
            base.OnElementChanged(e);

            this.Control.SetTextColor(AppConstants.ColorDarkGrey.ToAndroid());
            this.Control.SetTextSize(Android.Util.ComplexUnitType.Pt, 10);
        }
开发者ID:jacobduijzer,项目名称:WerktijdenApp,代码行数:7,代码来源:CustomTimePickerRenderer.cs


示例7: GetSpanColor

        /// <summary>
        /// Gets the color of the span.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="defaultColors">The default colors.</param>
        /// <returns>Android.Graphics.Color.</returns>
        public Android.Graphics.Color GetSpanColor(Xamarin.Forms.Color color, ColorStateList defaultColors)
        {
            if (color == Xamarin.Forms.Color.Default)
                return new Android.Graphics.Color(defaultColors.DefaultColor);

            return color.ToAndroid();
        }
开发者ID:jdluzen,项目名称:Xamarin-Forms-Labs,代码行数:13,代码来源:TextViewRenderHelper.cs


示例8: PushPage

        public virtual async Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animated = true)
		{
			if (modal)
                await Navigation.PushModalAsync (new NavigationPage(page), animated);
			else
                await ((NavigationPage)_tabbedNavigationPage.CurrentPage).PushAsync (page, animated); 
		}
开发者ID:gaoxl,项目名称:FreshMvvm,代码行数:7,代码来源:CustomImplementedNav.cs


示例9: XFPopupDlg

        public XFPopupDlg(Page _parent, Xamarin.Forms.View _content,  bool _cancelable, String _title, bool _rightClose, String _ok, String _ko)
        {
            var g = GenDialog (_content, _cancelable, _title, _rightClose, _ok, _ko);

            var svr = DependencyService.Get<IXFPopupSrvc> ();
            dlgNative = svr.CreateDialog(_parent, g, _cancelable);
        }
开发者ID:thaihung203,项目名称:xfpopup,代码行数:7,代码来源:XFPopupDlg.cs


示例10: OnElementChanged

        private static String SAMPLE = dir + "Video_2014_5_7__15_33_44.mpg";//"Video_2014_5_8__9_12_35.mpg";//"Video_2014_5_6__15_55_19.mpg";//


        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.View> e)
        {
            Android.Util.Log.Debug(this.GetType().Name, "OnElementChanged()");

            Android.Util.Log.Debug("Android API-int: ", Android.OS.Build.VERSION.Sdk);
            Android.Util.Log.Debug("Android API build: ", ""+Android.OS.Build.VERSION.SdkInt);
            Android.Util.Log.Debug("Android API: ", Android.OS.Build.VERSION.Codename);



            //first call into this method, the render was just created?
            if (e.OldElement == null)
            {
                surf = new SurfaceView(Context);

                myV = e.NewElement;//capture our Xamarin View.

                Android.Util.Log.Debug("X =", myV.X.ToString());

                myV.SizeChanged += myV_SizeChanged;
                myV.PropertyChanged += myV_PropertyChanged;

                base.SetNativeControl(surf);

                surf.Holder.AddCallback(this);
            }
        }
开发者ID:jasells,项目名称:Droid-Vid,代码行数:30,代码来源:CustomRenderer.cs


示例11: GetCell

		public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
		{
			var cell = base.GetCell(item, reusableCell, tv);
			cell.SelectionStyle = UITableViewCellSelectionStyle.None;

			return cell;
		}
开发者ID:daniel-luberda,项目名称:DLToolkit.Forms.Controls,代码行数:7,代码来源:FlowListViewInternalCellRenderer.cs


示例12: HandleSubMenu

        private static async void HandleSubMenu(Xamarin.Forms.MenuItem item, object parameter)
        {
            var cascadeMenuItem = item as CascadeMenuItem;
            var menu = cascadeMenuItem.SubMenu;

            if (menu == null || !menu.Any()) return;

            var element = cascadeMenuItem.Page;

            if (element != null)
            {
                var result = await element.DisplayActionSheet(item.Text, cancel: null, destruction: null,
                                        buttons: menu
                                        .Select(i => i.Text)
                                        .ToArray());

                if (result != null)
                {
                    var selectedItem = menu.First(x => x.Text == result);

                    if (selectedItem.Command?.CanExecute(selectedItem) == true)
                    {
                        selectedItem.Command.Execute(parameter);
                    }
                }
            }
        }
开发者ID:OfficeDev,项目名称:Interop-REST-Mail-Contacts-Calendar-Sample,代码行数:27,代码来源:CascadeMenuItem.cs


示例13: PushPage

		public async virtual Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animate = true)
        {
            if (modal)
				await Navigation.PushModalAsync (CreateContainerPage (page), animate);
            else
				await Navigation.PushAsync (page, animate);
        }
开发者ID:gaoxl,项目名称:FreshMvvm,代码行数:7,代码来源:FreshNavigationContainer.cs


示例14: OnElementChanged

		protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.DatePicker> e)
		{
			base.OnElementChanged(e);

			this.Control.SetTextColor(Android.Graphics.Color.Black);
			this.Control.SetTextSize(Android.Util.ComplexUnitType.Pt, 12);
		}
开发者ID:jacobduijzer,项目名称:WerktijdenApp,代码行数:7,代码来源:CustomDatePickerRender.cs


示例15: GetCellCore

		protected override View GetCellCore (Xamarin.Forms.Cell item, View convertView, ViewGroup parent, Context context)
		{

			var viewModel = (FullScheduleCellViewModel)item.BindingContext;
			LayoutInflater layoutInflater = LayoutInflater.FromContext (context);

			// creates the text color to be used depending on the track of the session
			var textColor = ((Xamarin.Forms.Color)new TrackTextColorConverter ()
				.Convert (viewModel.Track, typeof(Xamarin.Forms.Color), 
					null, CultureInfo.CurrentCulture))
				.ToAndroid ();

			var view = convertView;
			//if (view == null)
				view = layoutInflater.Inflate (Resource.Layout.FullScheduleCell, null);

			SetupTitle (view, viewModel, textColor, true);
			SetupLocation (view, viewModel, textColor, true);
			SetupTrack (view, viewModel, textColor, true);

			if(viewModel.IsOptional)
				SetupSelectButton (view, viewModel, textColor);

			// set the background color of the cell to the appropriate track color
			Color background = ((Xamarin.Forms.Color)new TrackBackgroundColorConverter ()
				.Convert (viewModel.Track, typeof(Xamarin.Forms.Color), null, CultureInfo.CurrentCulture)).ToAndroid ();
			view.SetBackgroundColor (background);

			return view;
		}
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:30,代码来源:FullScheduleCellRenderer.cs


示例16: GetCell

        public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableView tv)
        {
            TextCell textCell = (TextCell)item;
            UITableViewCellStyle style = UITableViewCellStyle.Value1;
            string text = "Xamarin.Forms.TextCell";
            CellTableViewCell cellTableViewCell = tv.DequeueReusableCell(text) as CellTableViewCell;
            if (cellTableViewCell == null)
            {
                cellTableViewCell = new CellTableViewCell(style, text);
            }
            else
            {
                cellTableViewCell.Cell.PropertyChanged -= new PropertyChangedEventHandler(cellTableViewCell.HandlePropertyChanged);
            }
            cellTableViewCell.Cell = textCell;
            textCell.PropertyChanged += new PropertyChangedEventHandler(cellTableViewCell.HandlePropertyChanged);
            cellTableViewCell.PropertyChanged = new Action<object, PropertyChangedEventArgs>(this.HandlePropertyChanged);
            cellTableViewCell.TextLabel.Text = textCell.Text;
            cellTableViewCell.DetailTextLabel.Text = textCell.Detail;
            //cellTableViewCell.TextLabel.TextColor = textCell.TextColor.ToUIColor(TextCellRenderer.DefaultTextColor);
            //cellTableViewCell.DetailTextLabel.TextColor = textCell.DetailColor.ToUIColor(TextCellRenderer.DefaultDetailColor);
            base.UpdateBackground(cellTableViewCell, item);

            cellTableViewCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;

            return cellTableViewCell;
        }
开发者ID:NamXH,项目名称:Orchard,代码行数:27,代码来源:CustomCellRenderers.cs


示例17: GetMaskShape

		CAShapeLayer GetMaskShape (ViewMaskerType maskType, Xamarin.Forms.Size size)
		{
			var layer = new CAShapeLayer ();
			layer.FillColor = UIColor.White.CGColor;
			layer.StrokeColor = UIColor.White.CGColor;
			layer.LineWidth = 0;
			UIBezierPath path = null;
			var bounds = new CGRect (0, 0, size.Width, size.Height);

			switch (maskType) {
			case ViewMaskerType.Circle:
				path = UIBezierPath.FromRoundedRect (bounds, (nfloat)Math.Max (size.Width, size.Height));
				break;
			case ViewMaskerType.Triangle:
				var point1 = new CGPoint (0, size.Height);
				var point2 = new CGPoint (size.Width, size.Height);
				var point3 = new CGPoint (size.Width / 2, 0);
				path = new UIBezierPath ();
				path.MoveTo (point1);
				path.AddLineTo (point2);
				path.AddLineTo (point3);
				path.AddLineTo (point1);
				path.ClosePath ();
				path.Fill ();
				break;
			case ViewMaskerType.Square:
				var smallRectangle = UIBezierPath.FromRect (bounds.Inset (50, 50));
				path = UIBezierPath.FromRoundedRect (bounds, 20);
				break;
			default:
				throw new ArgumentOutOfRangeException ();
			}
			layer.Path = path.CGPath;
			return layer;
		}
开发者ID:DevinvN,项目名称:TwinTechsFormsLib,代码行数:35,代码来源:ViewMaskExtensionProvider.cs


示例18: OnElementChanged

		protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<SearchBar> e)
		{
			base.OnElementChanged(e);
			if (this.Control == null || this.Element == null)
				return;
			updateBackground();
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:7,代码来源:SearchBarExRenderer.cs


示例19: OnPushed

 private void OnPushed(object sender, Xamarin.Forms.NavigationEventArgs e)
 {
     var vm = e.Page.BindingContext as IViewModel;
     if (vm != null)
     {
         vm.OnPushed();
     }
 }
开发者ID:jaydeboer,项目名称:XamarinFormsAutofacMvvmStarterKit,代码行数:8,代码来源:NavigationPage.cs


示例20: OnPositionError

 private void OnPositionError(object sender, Xamarin.Geolocation.PositionErrorEventArgs e) {
     if (this.PositionError != null) {
         var error = e.Error == GeolocationError.Unauthorized
             ? GeoLocationError.Unauthorized
             : GeoLocationError.PositionUnavailable;
         this.PositionError(this, new PositionErrorEventArgs(error));
     }
 }
开发者ID:k-oulebsir,项目名称:acr-xamarin-forms,代码行数:8,代码来源:GeoLocator.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# XamlObjectReader类代码示例发布时间:2022-05-24
下一篇:
C# XafApplication类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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