本文整理汇总了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;
}
示例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> ();
}
示例3: CreateTapGestureRecognizer
TapGestureRecognizer CreateTapGestureRecognizer ()
{
var tapGestureRecognizer = new TapGestureRecognizer ();
tapGestureRecognizer.SetBinding (TapGestureRecognizer.CommandProperty, "LaunchCamera");
return tapGestureRecognizer;
}
示例4: CreateTapGestureRecognizer
IGestureRecognizer CreateTapGestureRecognizer ()
{
var recognizer = new TapGestureRecognizer ();
recognizer.SetBinding (TapGestureRecognizer.CommandProperty, "ItemTapped");
return recognizer;
}
示例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 };
}
示例6: CreateTapGestureRecognizer
IGestureRecognizer CreateTapGestureRecognizer ()
{
var tapGestureRecognizer = new TapGestureRecognizer ();
tapGestureRecognizer.SetBinding (TapGestureRecognizer.CommandProperty, "ToggleSelection");
return tapGestureRecognizer;
}