public SpeakersPageWrap() { Title = "Speakers (WrapPanel demo)"; WrapLayout layout = new WrapLayout { Spacing = 5, Orientation = StackOrientation.Horizontal, Padding = new Thickness(5, Device.OnPlatform(20, 0, 0), 5, 0), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; var speakers = App.Database.GetSpeakers(); foreach (var speaker in speakers) { var cell = new StackLayout { WidthRequest = 50, HeightRequest = 50, Children = { new Image { Source = speaker.HeadshotUrl, VerticalOptions = LayoutOptions.Start, WidthRequest = 30, HeightRequest = 30 }, new Label { Text = speaker.Name, Font = Font.SystemFontOfSize(9), LineBreakMode = LineBreakMode.TailTruncation, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center } } }; layout.Children.Add(cell); } // simple WrapLayout population // for (int i = 0; i < 5; i++) { // // layout.Children.Add(new Label() { // BackgroundColor = Color.Blue, // WidthRequest = 75, // HeightRequest = 75, // YAlign = TextAlignment.Center, // XAlign = TextAlignment.Center, // TextColor = Color.White, // Text = i.ToString(), // }); // } Content = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Content = layout }; }
private void WrapDO_Click(object sender, RoutedEventArgs e) { if (TargetPanel.LayoutDefinitions[0] is WrapLayout) { WrapLayout wl = (WrapLayout)TargetPanel.LayoutDefinitions[0]; if (wl.Orientation == Orientation.Horizontal) { wl.Orientation = Orientation.Vertical; } else { wl.Orientation = Orientation.Horizontal; } if (wl.ItemHeight != 80) { wl.ItemHeight = 80; } else { wl.ItemHeight = double.NaN; } if (wl.ItemWidth != 80) { wl.ItemWidth = 80; } else { wl.ItemWidth = double.NaN; } } }
public SpeakersPageWrap () { Title = "Speakers (WrapPanel demo)"; WrapLayout layout = new WrapLayout { Spacing = 5, Orientation = StackOrientation.Horizontal, Padding = new Thickness(5,Device.OnPlatform(20,0,0),5,0), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; var speakers = App.Database.GetSpeakers (); foreach (var speaker in speakers) { var cell = new StackLayout { WidthRequest = 50, HeightRequest = 50, Children = { new Image {Source = speaker.HeadshotUrl, VerticalOptions = LayoutOptions.Start, WidthRequest=30, HeightRequest=30}, new Label {Text = speaker.Name, Font = Font.SystemFontOfSize(9), LineBreakMode = LineBreakMode.TailTruncation, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center} } }; layout.Children.Add (cell); } // simple WrapLayout population // for (int i = 0; i < 5; i++) { // // layout.Children.Add(new Label() { // BackgroundColor = Color.Blue, // WidthRequest = 75, // HeightRequest = 75, // YAlign = TextAlignment.Center, // XAlign = TextAlignment.Center, // TextColor = Color.White, // Text = i.ToString(), // }); // } Content = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Content = layout }; }
public LegendAndTitlesSample(PieChartSample chartSample) : base() { FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample); chart.HeaderText = EntryInputs.headerText; chart.HeaderFont = Font.SystemFontOfSize(30); chart.HeaderTextColor = Color.FromHex("#666666"); chart.FooterText = EntryInputs.footerText; chart.FooterFont = Font.SystemFontOfSize(15); chart.FooterTextColor = Color.FromHex("#666666"); chart.Legend.Position = Xuni.Xamarin.ChartCore.ChartPositionType.Bottom; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout stepperStack = new WrapLayout(); stepperStack.Orientation = StackOrientation.Horizontal; Entry headerEntry = new Entry(); headerEntry.VerticalOptions = LayoutOptions.FillAndExpand; headerEntry.HorizontalOptions = LayoutOptions.FillAndExpand; stepperStack.Children.Add(EntryInputs.getHeaderEntry(chart)); stepperStack.Children.Add(EntryInputs.getFooterEntry(chart)); stepperStack.Children.Add(Pickers.GetLegendPositionPicker(chart)); mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return sibling.Y + sibling.Height; }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return parent.Width; }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return parent.Height - sibling.Height; })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { stepperStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public LegendAndTitlesSample(PieChartSample chartSample) : base() { FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample); chart.HeaderText = EntryInputs.headerText; chart.HeaderFont = Font.SystemFontOfSize(30); chart.HeaderTextColor = Color.FromHex("#666666"); chart.FooterText = EntryInputs.footerText; chart.FooterFont = Font.SystemFontOfSize(15); chart.FooterTextColor = Color.FromHex("#666666"); chart.Legend.Position = Xuni.Xamarin.ChartCore.ChartPositionType.Bottom; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout stepperStack = new WrapLayout(); stepperStack.Orientation = StackOrientation.Horizontal; Entry headerEntry = new Entry(); headerEntry.VerticalOptions = LayoutOptions.FillAndExpand; headerEntry.HorizontalOptions = LayoutOptions.FillAndExpand; stepperStack.Children.Add(EntryInputs.getHeaderEntry(chart)); stepperStack.Children.Add(EntryInputs.getFooterEntry(chart)); stepperStack.Children.Add(Pickers.GetLegendPositionPicker(chart)); mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(sibling.Y + sibling.Height); }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(parent.Width); }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(parent.Height - sibling.Height); })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { stepperStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public ImageWrapLayoutPageCS() { _wrapLayout = new WrapLayout(); Content = new ScrollView { Margin = new Thickness(20, 35, 20, 20), Content = _wrapLayout }; _client = new HttpClient(); }
internal override void OnOrientationChanged() { base.OnOrientationChanged(); if (this.layout == null) { return; } var newLayout = new WrapLayout(new GroupHierarchyAdapter(), this.layout.DefaultItemLength, this.ItemWidth); newLayout.SetSource(this.layout.ItemsSource, this.layout.GroupLevels, this.layout.TotalsPosition, this.layout.AggregatesLevel, 0, this.layout.ShowAggregateValuesInline); this.layout = newLayout; }
private WrapLayout GenerateNumberSetNumberWrapLayout() { var numberSetNumbersWrapLayout = new WrapLayout() { HorizontalOptions = LayoutOptions.EndAndExpand, Padding = new Thickness(0, 0, 0, 0) }; this.Title = "NumberSet Numbers"; numberSetNumbersWrapLayout.ItemTemplate = new DataTemplate(typeof(CustomNumberSetNumberCell)); numberSetNumbersWrapLayout.ItemsSource = _numberSetNumbersViewModel.NumberSetNumbers.ToList(); return(numberSetNumbersWrapLayout); }
public void OnXamlRendered(FrameworkElement control) { var repeater = control.FindDescendant("WrapRepeater") as ItemsRepeater; if (repeater != null) { repeater.ItemsSource = _items; _wrapLayout = repeater.Layout as WrapLayout; } _wrapScrollParent = control.FindDescendant("WrapScrollParent") as ScrollViewer; }
public AttendeesViewModel(WrapLayout wrapLayout, AttendeeViewType myType) { try { this.myType = myType; this.wrapLayout = wrapLayout; Refresh(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public SelectionSample(PieChartSample chartSample) : base() { FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample); chart.SelectionMode = Xuni.Xamarin.ChartCore.ChartSelectionModeType.Point; chart.SelectedItemOffset = .2; chart.SelectedDashes = new double[] { 20, 10 }; chart.SelectedBorderColor = Color.FromRgb(255, 0, 0); chart.SelectedBorderWidth = 3; chart.SelectedItemPosition = Xuni.Xamarin.ChartCore.ChartPositionType.Top; chart.IsAnimated = true; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout stepperStack = new WrapLayout(); stepperStack.Orientation = StackOrientation.Horizontal; stepperStack.Children.Add(Steppers.GetSelectedOffsetStepper(chart)); stepperStack.Children.Add(Pickers.GetSelectedItemPositionPicker(chart)); stepperStack.Children.Add(Switches.GetAnimatedSwitch(chart)); mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(sibling.Y + sibling.Height); }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(parent.Width); }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(parent.Height - sibling.Height); })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { stepperStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public SelectionSample(PieChartSample chartSample) : base() { FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample); chart.SelectionMode = Xuni.Xamarin.ChartCore.ChartSelectionModeType.Point; chart.SelectedItemOffset = .2; chart.SelectedDashes = new double[] { 20, 10 }; chart.SelectedBorderColor = Color.FromRgb(255, 0, 0); chart.SelectedBorderWidth = 3; chart.SelectedItemPosition = Xuni.Xamarin.ChartCore.ChartPositionType.Top; chart.IsAnimated = true; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout stepperStack = new WrapLayout(); stepperStack.Orientation = StackOrientation.Horizontal; stepperStack.Children.Add(Steppers.GetSelectedOffsetStepper(chart)); stepperStack.Children.Add(Pickers.GetSelectedItemPositionPicker(chart)); stepperStack.Children.Add(Switches.GetAnimatedSwitch(chart)); mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return sibling.Y + sibling.Height; }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return parent.Width; }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return parent.Height - sibling.Height; })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { stepperStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public SelectionModesSample(ChartSample chartSample) : base() { FlexChart chart = ChartSampleFactory.GetFlexChartSample(chartSample); chart.SelectedBorderColor = Color.FromRgb(255, 0, 0); chart.SelectedBorderWidth = 3; chart.SelectedDashes = new double[] { 20, 10 }; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout pickerStack = new WrapLayout(); pickerStack.Orientation = StackOrientation.Horizontal; Picker chartType = Pickers.GetChartTypePicker(chart); Picker selectionType = Pickers.GetSelectionModeTypePicker(chart); chartType.SelectedIndex = 0; selectionType.SelectedIndex = 1; pickerStack.Children.Add(chartType); pickerStack.Children.Add(selectionType); mainRelativeLayout.Children.Add(pickerStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return sibling.Y + sibling.Height; }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return parent.Width; }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return parent.Height - sibling.Height; })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { pickerStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public SelectionModesSample(ChartSample chartSample) : base() { FlexChart chart = ChartSampleFactory.GetFlexChartSample(chartSample); chart.SelectedBorderColor = Color.FromRgb(255, 0, 0); chart.SelectedBorderWidth = 3; chart.SelectedDashes = new double[] { 20, 10 }; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout pickerStack = new WrapLayout(); pickerStack.Orientation = StackOrientation.Horizontal; Picker chartType = Pickers.GetChartTypePicker(chart); Picker selectionType = Pickers.GetSelectionModeTypePicker(chart); chartType.SelectedIndex = 0; selectionType.SelectedIndex = 1; pickerStack.Children.Add(chartType); pickerStack.Children.Add(selectionType); mainRelativeLayout.Children.Add(pickerStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return(sibling.Y + sibling.Height); }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return(parent.Width); }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return(parent.Height - sibling.Height); })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { pickerStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
/// <summary> /// Initializes a new instance of the <see cref="ButtonGroup"/> class. /// </summary> public ButtonGroup() { _buttonLayout = new WrapLayout { Spacing = SPACING, Padding = PADDING, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; HorizontalOptions = LayoutOptions.FillAndExpand; VerticalOptions = LayoutOptions.Center; //Padding = new Thickness(Spacing); Content = _buttonLayout; _clickedCommand = new Command(SetSelectedButton); }
public ChartTypesSample(ChartSample chartSample) : base() { FlexChart chart = ChartSampleFactory.GetFlexChartSample(chartSample); RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout pickerStack = new WrapLayout(); pickerStack.Orientation = StackOrientation.Horizontal; Picker chartType = Pickers.GetChartTypePicker(chart); Picker stackingType = Pickers.GetChartStackingTypePicker(chart); Picker rotationType = Pickers.GetChartRotationTypePicker(chart); pickerStack.Children.Add(chartType); pickerStack.Children.Add(stackingType); pickerStack.Children.Add(rotationType); mainRelativeLayout.Children.Add(pickerStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return sibling.Y + sibling.Height; }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return parent.Width; }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return parent.Height - sibling.Height; })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { pickerStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public ChartTypesSample(ChartSample chartSample) : base() { FlexChart chart = ChartSampleFactory.GetFlexChartSample(chartSample); RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout pickerStack = new WrapLayout(); pickerStack.Orientation = StackOrientation.Horizontal; Picker chartType = Pickers.GetChartTypePicker(chart); Picker stackingType = Pickers.GetChartStackingTypePicker(chart); Picker rotationType = Pickers.GetChartRotationTypePicker(chart); pickerStack.Children.Add(chartType); pickerStack.Children.Add(stackingType); pickerStack.Children.Add(rotationType); mainRelativeLayout.Children.Add(pickerStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return(sibling.Y + sibling.Height); }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return(parent.Width); }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return(parent.Height - sibling.Height); })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { pickerStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public BasicFeaturesSample(PieChartSample chartSample) : base() { FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample); chart.InnerRadius = 0.3; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout stepperStack = new WrapLayout(); stepperStack.Orientation = StackOrientation.Horizontal; stepperStack.Children.Add(Steppers.GetInnerRadiusStepper(chart)); stepperStack.Children.Add(Steppers.GetOffsetStepper(chart)); stepperStack.Children.Add(Steppers.GetStartAngleStepper(chart)); stepperStack.Children.Add(Switches.GetRotatedSwitch(chart)); mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(sibling.Y + sibling.Height); }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(parent.Width); }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return(parent.Height - sibling.Height); })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { stepperStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public BasicFeaturesSample(PieChartSample chartSample) : base() { FlexPie chart = PieChartSampleFactory.GetFlexChartSample(chartSample); chart.InnerRadius = 0.3; RelativeLayout mainRelativeLayout = new RelativeLayout(); WrapLayout stepperStack = new WrapLayout(); stepperStack.Orientation = StackOrientation.Horizontal; stepperStack.Children.Add(Steppers.GetInnerRadiusStepper(chart)); stepperStack.Children.Add(Steppers.GetOffsetStepper(chart)); stepperStack.Children.Add(Steppers.GetStartAngleStepper(chart)); stepperStack.Children.Add(Switches.GetRotatedSwitch(chart)); mainRelativeLayout.Children.Add(stepperStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return sibling.Y + sibling.Height; }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return parent.Width; }), Constraint.RelativeToView(stepperStack, (parent, sibling) => { return parent.Height - sibling.Height; })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { stepperStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
/// <summary> /// Dashboard /// </summary> public void DashboardLayout() { try { Grid grid = new Grid { }; List <SchoolManagement.Core.Models.MenuItem> lstPage = new MenuListData(); WrapLayout layout = new WrapLayout { Spacing = 5, Padding = new Thickness(5, Device.OnPlatform(20, 0, 0), 5, 0), //HorizontalOptions = LayoutOptions.Center, //VerticalOptions = LayoutOptions.Center, }; //for (int i = 0; i < lstPage.Count; i++) //{ // var cell = new StackLayout // { // //WidthRequest = 50, // //HeightRequest = 50, // Children = { // new Image {Source = lstPage[i].imagePath, // VerticalOptions = LayoutOptions.Start, // //BackgroundColor = Color.Blue, // WidthRequest=30, // HeightRequest=30}, // new Label {Text = lstPage[i].item, // //FontSize = 9, // LineBreakMode = LineBreakMode.TailTruncation, // } // } // }; // layout.Children.Add(cell); //} //for (int i = 0; i < lstPage.Count; i++) //{ // if (i == 0) // { // grid.Children.Add(new Label // { // Text = lstPage[i].MobileName, // TextColor = Color.Blue, // BackgroundColor = Color.Yellow, // XAlign = TextAlignment.Center, // YAlign = TextAlignment.Center, // }, 0, 0); // } // else if (i % 2 == 0) // { // grid.Children.Add(new Label // { // Text = lstPage[i].MobileName, // TextColor = Color.Blue, // BackgroundColor = Color.Yellow, // XAlign = TextAlignment.Center, // YAlign = TextAlignment.Center, // }, i, 1); // } // else // { // grid.Children.Add(new Label // { // Text = lstPage[i].MobileName, // TextColor = Color.Blue, // BackgroundColor = Color.Yellow, // XAlign = TextAlignment.Center, // YAlign = TextAlignment.Center, // }, i, 0); // } //} List <Menu> data = new List <Menu>(); for (int i = 1; i <= 10; i++) { data.Add(new Menu() { Name = string.Format("data 1 {0}", i) }); } int noOfCol = 5; StackLayout slLAble = new StackLayout(); int totaLoop = (int)Math.Ceiling((double)data.Count / noOfCol); for (int i = 0; i < totaLoop; i++) { string d1 = string.Empty; for (int j = 0; j < noOfCol; j++) { int index = (i * noOfCol) + j; if (data.Count <= index) { break; } d1 += data[index].Name + ","; grid.Children.Add(new Label { Text = i + " " + j, TextColor = Color.White }, i, j); } } ////grid.Children.Add(new Label ////{ //// Text = "Span 1", //// TextColor = Color.Blue, //// BackgroundColor = Color.Yellow, //// XAlign = TextAlignment.Center, //// YAlign = TextAlignment.Center, ////}, 0, 0); ////grid.Children.Add(new Label ////{ //// Text = "Span 1", //// TextColor = Color.Silver, //// BackgroundColor = Color.Yellow, //// XAlign = TextAlignment.Center, //// YAlign = TextAlignment.Center, ////}, 0, 1); ////grid.Children.Add(new Label ////{ //// Text = "Span 2", //// TextColor = Color.Blue, //// BackgroundColor = Color.Yellow, //// XAlign = TextAlignment.Center, //// YAlign = TextAlignment.Center, ////}, 1, 0); ////grid.Children.Add(new Label ////{ //// Text = "Span 2", //// TextColor = Color.Silver, //// BackgroundColor = Color.Yellow, //// XAlign = TextAlignment.Center, //// YAlign = TextAlignment.Center, ////}, 1, 1); ////grid.Children.Add(new Label ////{ //// Text = "Span 3", //// TextColor = Color.Blue, //// BackgroundColor = Color.Yellow, //// XAlign = TextAlignment.Center, //// YAlign = TextAlignment.Center, ////}, 2, 0); ////grid.Children.Add(new Label ////{ //// Text = "Span 3", //// TextColor = Color.Silver, //// BackgroundColor = Color.Yellow, //// XAlign = TextAlignment.Center, //// YAlign = TextAlignment.Center, ////}, 2, 1); //grid.Children.Add(new Label //{ // Text = "Span 2 columns", // TextColor = Color.Blue, // BackgroundColor = Color.Yellow, // XAlign = TextAlignment.Center, // YAlign = TextAlignment.Center, //}, 0, 2); //grid.Children.Add(new Label //{ // Text = "Span 2 columns", // TextColor = Color.Silver, // BackgroundColor = Color.Yellow, // XAlign = TextAlignment.Center, // YAlign = TextAlignment.Center, // //HorizontalTextAlignment = TextAlignment.Center, // //VerticalTextAlignment = TextAlignment.Center //}, 1, 2); //grid.Children.Add(new Label //{ // Text = "Span 3 columns", // TextColor = Color.Blue, // BackgroundColor = Color.Yellow, // XAlign = TextAlignment.Center, // YAlign = TextAlignment.Center, //}, 0, 3); //grid.Children.Add(new Label //{ // Text = "Span 3 columns", // TextColor = Color.Silver, // BackgroundColor = Color.Yellow, // XAlign = TextAlignment.Center, // YAlign = TextAlignment.Center, //}, 1, 3); // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); // Build the page. Content = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Content = grid }; } catch (Exception ex) { throw; } }
/// <summary> /// /// </summary> public CustomShuffleCell() { Grid grid = new Grid { Padding = new Thickness(30, 30, 30, 30), RowDefinitions = new RowDefinitionCollection { new RowDefinition { }, }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }, }, }; WrapLayout nameWrapLayout = new WrapLayout(); var shuffleNameLabel = new Label(); shuffleNameLabel.SetBinding(Label.TextProperty, new Binding("ShuffleDateTime")); shuffleNameLabel.VerticalOptions = LayoutOptions.StartAndExpand; shuffleNameLabel.HorizontalOptions = LayoutOptions.StartAndExpand; nameWrapLayout.Children.Add(shuffleNameLabel); WrapLayout shuffleWrapLayout = new WrapLayout(); var shuffleConcat = new Label(); shuffleConcat.SetBinding(Label.TextProperty, new Binding("ResultOfShuffleConcatenated")); shuffleConcat.VerticalOptions = LayoutOptions.StartAndExpand; shuffleConcat.HorizontalOptions = LayoutOptions.StartAndExpand; shuffleConcat.WidthRequest = 200; shuffleWrapLayout.WidthRequest = 200; shuffleWrapLayout.Children.Add(shuffleConcat); WrapLayout picksWrapLayout = new WrapLayout(); var shufflePicks = new Label(); shufflePicks.SetBinding(Label.TextProperty, new Binding("ResultOfShufflePicksConcatenated")); shufflePicks.VerticalOptions = LayoutOptions.StartAndExpand; shufflePicks.HorizontalOptions = LayoutOptions.StartAndExpand; shufflePicks.WidthRequest = 200; picksWrapLayout.WidthRequest = 200; picksWrapLayout.Children.Add(shufflePicks); grid = new Grid(); grid.Children.Add(nameWrapLayout, 0, 0); grid.Children.Add(shuffleWrapLayout, 1, 0); grid.Children.Add(picksWrapLayout, 2, 0); var view = grid; AddTapGesture(view); View = view; }
private void BuildLayout() { Grid grid1 = new Grid(); grid1.VerticalOptions = LayoutOptions.FillAndExpand; grid1.HorizontalOptions = LayoutOptions.FillAndExpand; RowDefinition row1 = new RowDefinition(); row1.Height = new GridLength(1, GridUnitType.Star); RowDefinition row2 = new RowDefinition(); row2.Height = GridLength.Auto; grid1.RowDefinitions.Add(row1); grid1.RowDefinitions.Add(row2); var layout = new WrapLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Spacing = 20, Orientation = StackOrientation.Horizontal, }; for (int i = 0; i < 8; i++) { var imgStr = "disaster-0" + (i + 1); var image = new Image { Source = Data.GetImageSource(imgStr), Aspect = Aspect.AspectFit, WidthRequest = 100, HeightRequest = 100 }; ImageWithInfo iWI = new ImageWithInfo { Info = imgStr, Image = image }; var tapGesture = new TapGestureRecognizer { Command = new Command(AlertTap), CommandParameter = iWI }; image.GestureRecognizers.Add(tapGesture); layout.Children.Add(image); } grid1.Children.Add(layout); Grid grid2 = new Grid(); ColumnDefinition grid2Column0 = new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star), }; ColumnDefinition grid2Column1 = new ColumnDefinition() { Width = GridLength.Auto, }; grid2.HorizontalOptions = LayoutOptions.FillAndExpand; grid2.Children.Add(entry); entry.HorizontalOptions = LayoutOptions.FillAndExpand; Grid.SetColumn(entry, 0); submitButton.Text = "Submit"; submitButton.IsEnabled = false; var tapSubmit = new TapGestureRecognizer { Command = new Command(SubmitTap), CommandParameter = SelectedImage }; submitButton.GestureRecognizers.Add(tapSubmit); grid2.Children.Add(submitButton); Grid.SetColumn(submitButton, 1); grid1.Children.Add(grid2); Grid.SetRow(grid2, 1); MainGrid.Children.Add(grid1); }
public ScreenshotsPage(BeyondRootModel Page) { NavigationPage.SetBackButtonTitle (this, ""); this.Title = Page.pageName; this.BackgroundColor = Color.FromRgb (70, 124, 154); StackLayout pageView = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand }; ScrollView scrollContent = new ScrollView { Content = pageView, VerticalOptions = LayoutOptions.FillAndExpand }; WrapLayout layout = new WrapLayout () { Spacing = 0, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0,0,0,0) }; List<Frame> imageList = new List<Frame> (); int i = 0; int imgwidth = 0; if ((DeviceInfo.Instance.ScreenWidth % 3) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 4) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 6) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 8) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 10) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } foreach (BeyondImage image in Page.screenshots) { imageList.Add(new Frame () { WidthRequest = imgwidth, HeightRequest = imgwidth, OutlineColor = Color.FromHex("007DA1"), HasShadow = false, Padding = 0, Content = new Image () { Source = ImageSource.FromStream (() => new System.IO.MemoryStream (image.image)), Aspect = Aspect.AspectFill } }); imageList [i].GestureRecognizers.Add (new TapGestureRecognizer { Command = new Command (() => { Navigation.PushAsync(new ContentPage () { Title = "View Image", BackgroundColor = Color.White, ToolbarItems = { new ToolbarItem ("Download", null, async () => { Device.OpenUri (new Uri(image.url)); }) }, Content = new Image () { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Source = ImageSource.FromStream (() => new System.IO.MemoryStream (image.image)), Aspect = Aspect.AspectFit } }); }), NumberOfTapsRequired = 1 }); layout.Children.Add(imageList[i]); i++; } pageView.Children.Add (layout); this.Content = scrollContent; }
private View criarPararButton() { var gridLayout = new Grid { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.End }; var imagemStop = new Image { Source = ImageSource.FromFile("Stop.png"), Style = EstiloUtils.Percurso.GravarImagem }; var tituloLabel = new Label { Text = "Parar Percurso!", Style = EstiloUtils.Percurso.GravarTitulo }; var descricaoLayout = new WrapLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Fill, //WidthRequest = TelaUtils.LarguraSemPixel * 0.7, Spacing = 1, Children = { new Image { Source = ImageSource.FromFile("relogio_20x20_preto.png") }, _tempoCorrendo, new Image { Source = ImageSource.FromFile("ampulheta_20x20_preto.png") }, _tempoParado, new Image { Source = ImageSource.FromFile("mao_20x20_preto.png") }, _paradas, new Image { Source = ImageSource.FromFile("velocimetro_20x20_preto.png") }, _velocidadeMedia, new Image { Source = ImageSource.FromFile("velocimetro_20x20_preto.png") }, _velocidadeMaxima, new Image { Source = ImageSource.FromFile("radar_20x20_preto.png") }, _radares } }; //gridLayout.Padding = new Thickness(30, 30, 30, 40); gridLayout.Padding = new Thickness(10, 10, 10, 20); gridLayout.HeightRequest = 150; gridLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0.25, GridUnitType.Star) }); gridLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0.75, GridUnitType.Star) }); gridLayout.Children.Add(imagemStop, 0, 0); gridLayout.Children.Add(tituloLabel, 1, 0); gridLayout.Children.Add(descricaoLayout, 1, 1); Grid.SetRowSpan(imagemStop, 2); gridLayout.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => { pararPercurso(); }) }); return(gridLayout); }
public CharacterViewPage(BeyondCharacterModel Page) { NavigationPage.SetBackButtonTitle (this, " "); this.Title = Page.pageName; RelativeLayout pageLayout = new RelativeLayout (); StackLayout pageView = new StackLayout () { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; ScrollView scrollContent = new ScrollView { Content = pageView, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; HtmlView test = new HtmlView (); ContentView slideContentHolder = new ContentView () { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = new Thickness(10,10,10,0) }; ContentView imageHolder = new ContentView () { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = new Thickness(0,15,0,15) }; Image storyImage = new Image () { HeightRequest = 450, Aspect = Aspect.AspectFit }; Image backgroundImage = new Image () { Source = "bg2.jpg", Aspect = Aspect.AspectFill }; Byte[] ImageBase64 = System.Convert.FromBase64String(Page.characterRightHandSideImage); storyImage.Source = ImageSource.FromStream (() => new System.IO.MemoryStream (ImageBase64)); slideContentHolder.Content = test; imageHolder.Content = storyImage; test.Text = Page.characterDescription; pageLayout.Children.Add (backgroundImage, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((parent) => { return parent.Width; }), Constraint.RelativeToParent ((parent) => { return parent.Height; }) ); pageLayout.Children.Add (scrollContent, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((parent) => { return parent.Width; }), Constraint.RelativeToParent ((parent) => { return parent.Height; }) ); pageView.Children.Add (imageHolder); pageView.Children.Add (slideContentHolder); ContentView statsHolder = new ContentView () { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = new Thickness(5,5,5,5)}; HtmlView stats = new HtmlView () { Text = BeyondUtility.stripUnRequiredTags(Page.characterStats), XAlign = TextAlignment.Center, YAlign = TextAlignment.Center }; statsHolder.Content = stats; pageView.Children.Add (statsHolder); if (Page.characterScreenshotsConceptArt != null) { ContentView labelView = new ContentView { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = 10 }; Label text = new Label () { FontFamily = Device.OnPlatform("Orbitron",null,null), TextColor = Color.White, Text = "Tap an image to view a larger version", XAlign = TextAlignment.Center }; labelView.Content = text; ContentView imagesHolder = new ContentView () { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = new Thickness(0,0,0,0) }; WrapLayout layout = new WrapLayout () { Spacing = 0, Orientation = StackOrientation.Horizontal }; List<Frame> imageList = new List<Frame> (); int i = 0; int imgwidth = 0; if ((DeviceInfo.Instance.ScreenWidth % 3) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 4) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 6) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 8) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } if ((DeviceInfo.Instance.ScreenWidth % 10) == 0) { imgwidth = (DeviceInfo.Instance.ScreenWidth / 3); } foreach (BeyondImage image in Page.characterScreenshotsConceptArt) { imageList.Add(new Frame () { HeightRequest = imgwidth, WidthRequest = imgwidth, HasShadow = false, Padding = 0, OutlineColor = Color.FromHex("007DA1"), Content = new Image () { Source = ImageSource.FromStream (() => new System.IO.MemoryStream (image.image)), Aspect = Aspect.AspectFill } }); imageList [i].GestureRecognizers.Add (new TapGestureRecognizer { Command = new Command (() => { Navigation.PushAsync(new ContentPage () { Title = "View Image", BackgroundColor = Color.White, ToolbarItems = { new ToolbarItem ("Download", null, async () => { Device.OpenUri (new Uri(image.url)); }) }, Content = new Image () { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Source = ImageSource.FromStream (() => new System.IO.MemoryStream (image.image)), Aspect = Aspect.AspectFit } }); }), NumberOfTapsRequired = 1 }); layout.Children.Add(imageList[i]); i++; } imagesHolder.Content = layout; pageView.Children.Add (labelView); pageView.Children.Add (imagesHolder); } this.Content = pageLayout; }
public WrapLayoutStrategy(ItemModelGenerator generator, IOrientedParentView owner, double defaultItemLength, double defaultItemOppositeLength) : base(generator, owner) { this.layout = new WrapLayout(new GroupHierarchyAdapter(), defaultItemLength, defaultItemOppositeLength); this.ItemWidth = defaultItemOppositeLength; }
public ConteudoCelula() { MenuItem excluirRadar = new MenuItem(); excluirRadar.CommandParameter = "{Binding .}"; excluirRadar.Text = "Excluir"; excluirRadar.IsDestructive = true; excluirRadar.Clicked += (object sender, EventArgs e) => { RadarInfo radar = (RadarInfo)((MenuItem)sender).BindingContext; RadarBLL regraRadar = RadarFactory.create(); regraRadar.excluir(radar.Id); var RadarListView = this.Parent as ListView; RadarListView.SetBinding(ListView.ItemsSourceProperty, new Binding(".")); var percursos = regraRadar.listar(true); RadarListView.BindingContext = percursos; RadarListView.ItemTemplate = new DataTemplate(typeof(ConteudoCelula)); }; this.ContextActions.Add(excluirRadar); //desc.VerticalOptions = LayoutOptions.Center; desc.HorizontalOptions = LayoutOptions.FillAndExpand; desc.Orientation = StackOrientation.Horizontal; StackLayout main = new StackLayout() { Margin = new Thickness(5, 0, 5, 0), VerticalOptions = LayoutOptions.Fill, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, WidthRequest = TelaUtils.LarguraSemPixel }; Frame cardLeft = new Frame() { HorizontalOptions = LayoutOptions.Start, Margin = new Thickness(0, 0, 0, 0), WidthRequest = main.WidthRequest * 0.2 }; StackLayout cardLeftStack = new StackLayout() { Orientation = StackOrientation.Vertical }; Image percursoIco = new Image() { Source = ImageSource.FromFile("meusradares.png"), WidthRequest = cardLeft.WidthRequest / 1.5, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; cardLeftStack.Children.Add(percursoIco); cardLeft.Content = cardLeftStack; Frame cardRigth = new Frame() { HorizontalOptions = LayoutOptions.Start, WidthRequest = main.WidthRequest * 0.7 }; WrapLayout cardRigthStackHor = new WrapLayout() { //Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Spacing = 1 }; StackLayout cardRigthStackVer = new StackLayout() { Orientation = StackOrientation.Vertical, Spacing = 1 }; Label titulo = new Label() { //Text = "31/0ut - 17:41", HorizontalOptions = LayoutOptions.StartAndExpand, FontSize = 26, FontFamily = "Roboto-Condensed", TextColor = Color.FromHex(TemaInfo.PrimaryColor) }; titulo.SetBinding(Label.TextProperty, new Binding("DataTituloStr")); Label limite = new Label() { HorizontalOptions = LayoutOptions.StartAndExpand, FontSize = 14, FontFamily = "Roboto-Condensed", TextColor = Color.FromHex(TemaInfo.PrimaryColor) }; limite.SetBinding(Label.TextProperty, new Binding("VelocidadeStr")); Label latitude = new Label() { HorizontalOptions = LayoutOptions.StartAndExpand, FontSize = 14, FontFamily = "Roboto-Condensed", TextColor = Color.FromHex(TemaInfo.PrimaryColor) }; latitude.SetBinding(Label.TextProperty, new Binding("LatitudeText")); Label longitude = new Label() { //Text = "Longitude: -49,23480 ", HorizontalOptions = LayoutOptions.StartAndExpand, FontSize = 14, FontFamily = "Roboto-Condensed", TextColor = Color.FromHex(TemaInfo.PrimaryColor) }; longitude.SetBinding(Label.TextProperty, new Binding("LongitudeText")); Label angulo = new Label() { //Text = "Ângulo: 179.0 ", HorizontalOptions = LayoutOptions.StartAndExpand, FontSize = 14, FontFamily = "Roboto-Condensed", TextColor = Color.FromHex(TemaInfo.PrimaryColor) }; angulo.SetBinding(Label.TextProperty, new Binding("DirecaoText")); Label endereco = new Label() { //Text = "Rua H-149, 1-73 Cidade Vera Cruz/ Aparecida de Goiânia ", HorizontalOptions = LayoutOptions.StartAndExpand, //VerticalOptions = LayoutOptions.StartAndExpand, //WidthRequest = cardRigth.WidthRequest * 0.8, FontSize = 16, FontFamily = "Roboto-Condensed", //HorizontalTextAlignment = TextAlignment.Center }; endereco.SetBinding(Label.TextProperty, new Binding("Endereco")); BoxView linha = new BoxView() { HeightRequest = 1, BackgroundColor = Color.FromHex(TemaInfo.DividerColor), VerticalOptions = LayoutOptions.CenterAndExpand }; if (TelaUtils.Orientacao == "LandscapeLeft" || TelaUtils.Orientacao == "LandscapeRight") { percursoIco.WidthRequest = cardLeft.WidthRequest / 2; //cardLeft.WidthRequest = main.WidthRequest * 0.15; cardRigth.WidthRequest = main.WidthRequest * 0.45; } cardRigthStackVer.Children.Add(titulo); cardRigthStackVer.Children.Add(linha); cardRigthStackHor.Children.Add(limite); cardRigthStackHor.Children.Add(latitude); cardRigthStackHor.Children.Add(longitude); cardRigthStackHor.Children.Add(angulo); cardRigthStackVer.Children.Add(cardRigthStackHor); cardRigthStackVer.Children.Add(endereco); cardRigthStackVer.WidthRequest = main.WidthRequest * 0.8; cardRigth.Content = cardRigthStackVer; main.Children.Add(cardLeft); main.Children.Add(cardRigth); View = main; }
public SpeakersPageWrap() { Title = "Speakers (WrapPanel demo)"; WrapLayout layout = new WrapLayout { Spacing = 5, Padding = new Thickness(5, Device.OnPlatform(20, 0, 0), 5, 0), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; var speakers = App.Database.GetSpeakers(); foreach (var speaker in speakers) { // configure cell for wrap var cell = new StackLayout { WidthRequest = 50, HeightRequest = 50, BackgroundColor = Color.FromRgb(222, 222, 222), Children = { new Image { Source = speaker.HeadshotUrl, VerticalOptions = LayoutOptions.Start, //BackgroundColor = Color.Blue, WidthRequest = 30, HeightRequest = 30 }, new Label { Text = speaker.Name, FontSize = 9, LineBreakMode = LineBreakMode.TailTruncation, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center } } }; // add touch handling to show next page var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.CommandParameter = speaker; tapGestureRecognizer.Tapped += (sender, e) => { var speakr = ((TappedEventArgs)e).Parameter as Speaker; var sp = new SpeakerPage(); sp.BindingContext = speakr; Navigation.PushAsync(sp); }; cell.GestureRecognizers.Add(tapGestureRecognizer); // add to wrap layout layout.Children.Add(cell); } // simple WrapLayout population // for (int i = 0; i < 5; i++) { // // layout.Children.Add(new Label() { // BackgroundColor = Color.Blue, // WidthRequest = 75, // HeightRequest = 75, // YAlign = TextAlignment.Center, // XAlign = TextAlignment.Center, // TextColor = Color.White, // Text = i.ToString(), // }); // } Content = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Content = layout }; }
public SpeakersPageWrap () { Title = "Speakers (WrapPanel demo)"; WrapLayout layout = new WrapLayout { Spacing = 5, Padding = new Thickness(5,Device.OnPlatform(20,0,0),5,0), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; var speakers = App.Database.GetSpeakers (); foreach (var speaker in speakers) { // configure cell for wrap var cell = new StackLayout { WidthRequest = 50, HeightRequest = 50, BackgroundColor = Color.FromRgb(222, 222, 222), Children = { new Image {Source = speaker.HeadshotUrl, VerticalOptions = LayoutOptions.Start, //BackgroundColor = Color.Blue, WidthRequest=30, HeightRequest=30}, new Label {Text = speaker.Name, FontSize = 9, LineBreakMode = LineBreakMode.TailTruncation, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center} } }; // add touch handling to show next page var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.CommandParameter = speaker; tapGestureRecognizer.Tapped += (sender, e) => { var speakr = ((TappedEventArgs)e).Parameter as Speaker; var sp = new SpeakerPage(); sp.BindingContext = speakr; Navigation.PushAsync(sp); }; cell.GestureRecognizers.Add(tapGestureRecognizer); // add to wrap layout layout.Children.Add (cell); } // simple WrapLayout population // for (int i = 0; i < 5; i++) { // // layout.Children.Add(new Label() { // BackgroundColor = Color.Blue, // WidthRequest = 75, // HeightRequest = 75, // YAlign = TextAlignment.Center, // XAlign = TextAlignment.Center, // TextColor = Color.White, // Text = i.ToString(), // }); // } Content = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Content = layout }; }