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


C# TapGestureRecognizer.SetBinding方法代码示例

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


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

示例1: CreateTopRow

        static View CreateTopRow ()
        {

			var profile = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Spacing = 18,
				HeightRequest = 50,
				Padding = new Thickness (20, 40, 10, 10),
				//BackgroundColor = Color.Green,
				Children = {
					CreateQRBox (),
					CreateNameStack ()
				}
			};
			profile.SetBinding(StackLayout.IsVisibleProperty, "HasProfile");
			var profileTapGesture = new TapGestureRecognizer();
			profileTapGesture.SetBinding (TapGestureRecognizer.CommandProperty, "AddContactCommand");
			profile.GestureRecognizers.Add (profileTapGesture);

			var noProfile = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Spacing = 18,
				HeightRequest = 50,
				Padding = new Thickness (20, 40, 10, 10),
				//BackgroundColor = Color.Red,
				Children = {
					CreateNoProfileView ()
				}
			};
			noProfile.SetBinding(StackLayout.IsVisibleProperty, "HasProfile", converter: new NegateValueConverter());
			var noProfileTapGesture = new TapGestureRecognizer();
			noProfileTapGesture.SetBinding<MenuViewModel> (TapGestureRecognizer.CommandProperty, vm => vm.CreateProfileCommand);
			noProfile.GestureRecognizers.Add (noProfileTapGesture);

			var grid = new Grid {
				Children = {
					profile,
					noProfile
				}
			};

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

示例2: MatrixView

		public MatrixView (MatrixMainPageView mainView)
		{
			InitializeComponent ();

			Title = "Матрица";

		    if (Device.OS == TargetPlatform.iOS)
		    {
		        Icon = "matrixTabIcon.png";

		        {
		            var btn = new Button() {Text = "Фильтры"};
		            btn.Clicked += (s, e) =>
		            {
		                mainView.IsPresented = !mainView.IsPresented;
		            };
		            Grid.SetRow(btn, 2);
		            grdRoot.Children.Add(btn);
		        }
		    }

		    grdRoot.Padding = Device.OnPlatform (10, 8, 10);
			grdHeaderContent.ColumnSpacing = Device.OnPlatform (25, 50, 0);
			cnvHeader.HeightRequest = Device.OnPlatform (80, 110, 0);
			cnvInfo.HeightRequest = Device.OnPlatform (80, 110, 0);

			lblInfo.FontSize = Device.OnPlatform (11, 14, 0);

			lblHeader1.FontSize = Device.OnPlatform (11, 14, 0);
			lblHeaderContent1.FontSize = Device.OnPlatform (11, 14, 0);
			lblHeader2.FontSize = Device.OnPlatform (11, 14, 0);
			lblHeaderContent2.FontSize = Device.OnPlatform (11, 14, 0);

			lblZ.FontSize = Device.OnPlatform (11, 14, 0);
			lblZ1.FontSize = Device.OnPlatform (11, 14, 0);
			lblZ2.FontSize = Device.OnPlatform (11, 14, 0);
			lblZ3.FontSize = Device.OnPlatform (11, 14, 0);
			lblZ4.FontSize = Device.OnPlatform (11, 14, 0);
			lblZ5.FontSize = Device.OnPlatform (11, 14, 0);
			lblZ6.FontSize = Device.OnPlatform (11, 14, 0);

			lblD.FontSize = Device.OnPlatform (11, 14, 0);
			lblD1.FontSize = Device.OnPlatform (11, 14, 0);
			lblD2.FontSize = Device.OnPlatform (11, 14, 0);
			lblD3.FontSize = Device.OnPlatform (11, 14, 0);
			lblD4.FontSize = Device.OnPlatform (11, 14, 0);
			lblD5.FontSize = Device.OnPlatform (11, 14, 0);
			lblD6.FontSize = Device.OnPlatform (11, 14, 0);

			lblStatus.FontSize = Device.OnPlatform (11, 14, 0);

		    stkChart.Spacing = Device.OnPlatform(5, 3, 0);

            {
		        var gesture=new TapGestureRecognizer();
                gesture.SetBinding(TapGestureRecognizer.CommandProperty,new Binding("GoToChartCommand"));
		        stkChart.GestureRecognizers.Add(gesture);
		    }

			_mainView = mainView;

			InitToolbar ();

			_repository = ContainerService.Instance.Container.Resolve<IMatrixCacheRepository> ();
		}
开发者ID:LordOfSmiles,项目名称:MatrixBuilderTest,代码行数:65,代码来源:MatrixView.xaml.cs

示例3: CreateTapGestureRecognizer

		TapGestureRecognizer CreateTapGestureRecognizer ()
		{
			var tapGestureRecognizer = new TapGestureRecognizer ();

			tapGestureRecognizer.SetBinding (TapGestureRecognizer.CommandProperty, "LaunchCamera");

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

示例4: CreateTapGestureRecognizer

 IGestureRecognizer CreateTapGestureRecognizer ()
 {
     var recognizer = new TapGestureRecognizer ();
     recognizer.SetBinding (TapGestureRecognizer.CommandProperty, "ItemTapped");
     return recognizer;
 }
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:6,代码来源:MenuCell.cs

示例5: BuildCalendarGrid

        /// <summary>
        /// Lay out the grid, calendar cells, days of the week. Everything but the events themselves.
        /// </summary>
        private void BuildCalendarGrid()
        {
            var startDate = Start.Date;
            var endDate = End.Date;

            var days = (endDate - startDate).Days;

            _cols = Math.Min(days, _daysInWeek);
            _rows = (int)Math.Ceiling((double)days / _daysInWeek);

            // Clear any existing events, just in case
            ClearEvents();

            _grid = new Grid();

            _grid.ColumnSpacing = 0;
            _grid.RowSpacing = 0;

            // Header
            _grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });

            // Configure columns and place headers labels (days of the week)
            //
            for (int i = 0; i < _cols; i++)
            {
                // Note that the drag/drop logic has hardcoded assumptions about this configuration, so simply
                // tweaking column definitions here (e.g. to give weekends different width or just make everything
                // a fixed-width) without updating that logic would break things.
                //
                _grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

                var label = new Label();
                label.Text = startDate.AddDays(i).DayOfWeek.ToString();
                label.XAlign = TextAlignment.Center;
                label.LineBreakMode = LineBreakMode.TailTruncation;
                label.FontSize = Device.GetNamedSize(NamedSize.Small, label);

                _grid.Children.Add(label, i, 0);
            }

            // Configure rows
            //
            for (int i = 0; i < _rows; i++)
            {
                // RowDefinition doesn't support MinHeight property yet...
                // (the MinHeight property is there, just marked internal...)
                //
                var height = (_rows <= 3) ? new GridLength(1, GridUnitType.Star) : new GridLength(_minRowHeight, GridUnitType.Absolute);
                _grid.RowDefinitions.Add(new RowDefinition { Height = height });
            }

            // Add calendar cells for each day
            //
            var day = startDate;

            for (int row = 0; row < _rows; row++)
            {
                for (int col = 0; col < _cols; col++)
                {
                    var calendarCell = new CalendarCellView { BindingContext = day.Date };

                    var tapGesture = new TapGestureRecognizer();
                    // Bind to the "parent" context (i.e., ours, as opposed to the cell's)
                    tapGesture.BindingContext = this;
                    tapGesture.SetBinding(TapGestureRecognizer.CommandProperty, "AddEventCommand");
                    tapGesture.CommandParameter = day.Date;
                    calendarCell.GestureRecognizers.Add(tapGesture);

                    _grid.Children.Add(calendarCell, col, row + 1);

                    day = day.AddDays(1);
                }
            }

            // Create one AutoStackGrid for each row in the main grid
            //
            for (int row = 0; row < _rows; row++)
            {
                var container = new AutoStackGrid();

                //container.IsEnabled = false;
                //container.InputTransparent = true;

                // Extra padding on top to accomodate the date display
                //
                container.Padding = new Thickness(0, 20, 0, 5);

                Grid.SetRow(container, row + 1);
                Grid.SetColumn(container, 0);
                Grid.SetColumnSpan(container, _cols);
                container.Columns = _cols;
                _grid.Children.Add(container);
                _labelContainers.Add(container);
            }

            Content = new ScrollView { Content = _grid };
        }
开发者ID:TheAlmightyBob,项目名称:TripSketch,代码行数:100,代码来源:EventsGrid.cs

示例6: CreateTapGestureRecognizer

 IGestureRecognizer CreateTapGestureRecognizer ()
 {
     var tapGestureRecognizer = new TapGestureRecognizer ();
     tapGestureRecognizer.SetBinding (TapGestureRecognizer.CommandProperty, "ToggleSelection");
     return tapGestureRecognizer;
 }
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:6,代码来源:FiltersCell.cs


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