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


C# Xamarin类代码示例

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


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


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