public TestImage() { fancyLabel = new MR.Gestures.Image() { Source = ImageSource.FromUri(new Uri("http://xamarin.com/content/images/pages/forms/example-app.png")), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, Scale = 1 }; check = new Label (); check.Text = "Hello"; fancyLabel.Panning += fancyLabel_Panning; fancyLabel.Pinching += fancyLabel_Pinching; fancyLabel.DoubleTapped += fancyLabel_DoubleTapped; //var tapGestureRecognizer = new TapGestureRecognizer(); //tapGestureRecognizer.Tapped += tapGestureRecognizer_Tapped; //fancyLabel.GestureRecognizers.Add(tapGestureRecognizer); StackLayout st = new StackLayout(); st.Children.Add (check); st.Children.Add (fancyLabel); Content = st; }
private StackLayout ShowActivity(Activity act) { var stack = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; var TitleLabel = new Label { FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }; var ageLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) }; var image = new MR.Gestures.Image { Source = act.Image, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; image.Tapped += ImageTapped; var summary = new ExtendedLabel { JustifyText = true, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) }; TitleLabel.Text = act.Title; ageLabel.Text = act.SubTitleWithDate; summary.Text = act.Summary; var grid = new Grid { HorizontalOptions = LayoutOptions.CenterAndExpand }; if (act.Links.Count() <= MaxColumn) { grid.RowDefinitions.Add(new RowDefinition()); } else { for (int row = 0; row < (act.Links.Count() / MaxColumn) + 1; row++) { grid.RowDefinitions.Add(new RowDefinition()); } } for (int col = 0; col < act.Links.Count(); col++) { if (col >= MaxColumn) { break; } grid.ColumnDefinitions.Add(new ColumnDefinition()); } var productIndex = 0; for (int rowIndex = 0; rowIndex < grid.RowDefinitions.Count(); rowIndex++) { for (int columnIndex = 0; columnIndex < grid.ColumnDefinitions.Count(); columnIndex++) { if (productIndex >= act.Links.Count) { break; } var product = act.Links[productIndex]; productIndex += 1; grid.Children.Add(new Button(product.Url, product.Title, product.IsUrl ? "externalLink.png" : "download.png", product.LinkTitle, product.IsUrl), columnIndex, rowIndex); } } stack.Children.Add(TitleLabel); stack.Children.Add(ageLabel); stack.Children.Add(image); stack.Children.Add(summary); stack.Children.Add(grid); stack.Children.Add(new BoxView() { Color = Color.FromHex("#1B3147"), WidthRequest = 100, HeightRequest = 2 }); return(stack); }