public void BuildTiles(IEnumerable <object> tiles) { try { if (tiles == null || tiles.Count() == 0) { Children?.Clear(); } // Wipe out the previous row definitions if they're there. RowDefinitions?.Clear(); var enumerable = tiles as IList ?? tiles.ToList(); var numberOfRows = Math.Ceiling(enumerable.Count / (float)MaxColumns); for (var i = 0; i < numberOfRows; i++) { RowDefinitions?.Add(new RowDefinition { Height = TileHeight }); } for (var index = 0; index < enumerable.Count; index++) { var column = index % MaxColumns; var row = (int)Math.Floor(index / (float)MaxColumns); var tile = BuildTile(enumerable[index]); Children?.Add(tile, column, row); } } catch { // can throw exceptions if binding upon disposal } }
private void Render() { Children?.Clear(); if (InternalItems != null && InternalItems.Count() > 0) { GenerateRows(); for (var index = 0; index < InternalItems.Count; index++) { int col = (int)(index % ColumnCount); var row = (int)Math.Floor(index / (float)ColumnCount); var image = CreateImage(InternalItems[index]); Children?.Add(image, col, row); } } }
public FileUploaderPageCS() { Children.Add(new ImageFileUploaderPageCS()); Children.Add(new TextFileUploaderPageCS()); Children.Add(new TextFileBrowserPageCS()); }
public SampleQueryBlockViewModel() : base(SessionVMBase.Nhib.GetSession(), () => { }) { if (IsRoot) Children.Add(new SampleQueryBlockViewModel()); }
public MainPage() { Children.Add(new PurplePage()); Children.Add(new TipsTricks()); Children.Add(new BluePage()); }
/// <summary> /// Ctor. /// </summary> /// <param name="expression">for which to return the result type or null if the result is null</param> public TypeOfExpression(Expression expression) { Children.Add(expression); }
public ApplicationGrid() { ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength((double)(App.ScreenHeight * 0.05)) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength((double)(App.ScreenHeight * 0.1)) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength((double)(App.ScreenHeight * 0.1)) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength((double)(App.ScreenHeight * 0.1)) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength((double)(App.ScreenHeight * 0.1)) }); //TODO: Step 3 - Comment out Forms Objects Children.Add(new Label() { Text = "Product" }, 0, 0); Children.Add(new Label() { Text = "Quantity" }, 1, 0); Children.Add(new Label() { Text = "Cliff Bars" }, 0, 1); Children.Add(new Entry() { Placeholder = "0" }, 1, 1); Children.Add(new Label() { Text = "Fruit Snack Packs" }, 0, 2); Children.Add(new Entry() { Placeholder = "0" }, 1, 2); Children.Add(new Label() { Text = "Juice Box" }, 0, 3); Children.Add(new Entry() { Placeholder = "0" }, 1, 3); Children.Add(new Label() { Text = "Apple" }, 0, 4); Children.Add(new Entry() { Placeholder = "0" }, 1, 4); //TODO: Step 4 - Utilize Custom Elements // Children.Add (new CustomLabel (){ Text = "Product" }, 0, 0); // Children.Add (new CustomLabel (){ Text = "Quantity" }, 1, 0); // Children.Add (new CustomLabel (){ Text = "Cliff Bars" }, 0, 1); // Children.Add (new CustomThemedEntry (){ Placeholder = "0" }, 1,1); // Children.Add (new CustomLabel (){ Text = "Fruit Snack Packs" }, 0, 2); // Children.Add (new CustomThemedEntry (){ Placeholder = "0" }, 1,2); // Children.Add (new CustomLabel (){ Text = "Juice Box" }, 0, 3); // Children.Add (new CustomThemedEntry (){ Placeholder = "0" }, 1,3); // Children.Add (new CustomLabel (){ Text = "Apple" }, 0, 4); // Children.Add (new CustomThemedEntry (){ Placeholder = "0" }, 1,4); }
public void AddChild(Node child) { ChildCount += 1; Children.Add(child); }
/// <summary> /// Determines whether additional overflow columns are needed and if existing columns can /// be removed. /// </summary> /// <param name="availableSize">The size of the space available, used to constrain the /// number of additional columns that can be created.</param> /// <returns>The resulting size of the original content plus any extra columns.</returns> protected override Size MeasureOverride(Size availableSize) { //availableSize = base.MeasureOverride(availableSize); Debug.WriteLine("RichTextColumn_Measure , AvailableSize {0}", availableSize); //if (Orientation == Orientation.Horizontal) // if (_measuredContainerSize == availableSize.Height && _measuredColumnSize == ColumnWidth) // return _measuredSize; // else // { // _measuredContainerSize = availableSize.Height; // _measuredColumnSize = ColumnWidth; // } //else //{ // if (_measuredContainerSize == availableSize.Width && _measuredColumnSize == ColumnHeight) // return _measuredSize; // else // { // _measuredContainerSize = availableSize.Width; // _measuredColumnSize = ColumnHeight; // } //} if (this.RichTextContent == null) { return(new Size(0, 0)); } //this.Children.Clear(); // Make sure the RichTextBlock is a child, using the lack of // a list of additional columns as a sign that this hasn't been // done yet if (this._overflowColumns == null) { Children.Add(this.RichTextContent); this._overflowColumns = new List <RichTextBlockOverflow>(); } // Start by measuring the original RichTextBlock content this.RichTextContent.Measure(availableSize); var maxWidth = this.RichTextContent.DesiredSize.Width; var maxHeight = this.RichTextContent.DesiredSize.Height; var hasOverflow = this.RichTextContent.HasOverflowContent; // Make sure there are enough overflow columns int overflowIndex = 0; bool condition = hasOverflow && this.ColumnTemplate != null; if (Orientation == Windows.UI.Xaml.Controls.Orientation.Horizontal) { condition = condition && maxWidth < availableSize.Width; } else { condition = condition && maxHeight < availableSize.Height; } while (condition) { // Use existing overflow columns until we run out, then create // more from the supplied template RichTextBlockOverflow overflow; if (this._overflowColumns.Count > overflowIndex) { overflow = this._overflowColumns[overflowIndex]; } else { overflow = (RichTextBlockOverflow)this.ColumnTemplate.LoadContent(); this._overflowColumns.Add(overflow); this.Children.Add(overflow); if (overflowIndex == 0) { this.RichTextContent.OverflowContentTarget = overflow; } else { this._overflowColumns[overflowIndex - 1].OverflowContentTarget = overflow; } } // Measure the new column and prepare to repeat as necessary overflow.Width = ColumnWidth; overflow.Height = ColumnHeight; if (Orientation == Windows.UI.Xaml.Controls.Orientation.Horizontal) { overflow.Measure(new Size(availableSize.Width - maxWidth, availableSize.Height)); hasOverflow = overflow.HasOverflowContent; if (double.IsNaN(ColumnWidth)) { maxWidth += overflow.DesiredSize.Width; } else { maxWidth += ColumnWidth; } maxHeight = Math.Max(maxHeight, overflow.DesiredSize.Height); condition = hasOverflow && maxWidth < availableSize.Width; } else // Vertical { overflow.Measure(new Size(availableSize.Width, availableSize.Height - maxHeight)); hasOverflow = overflow.HasOverflowContent; maxWidth = Math.Max(maxWidth, overflow.DesiredSize.Width); if (double.IsNaN(ColumnHeight)) { maxHeight += overflow.DesiredSize.Height; } else { maxHeight += ColumnHeight; } condition = hasOverflow && maxHeight < availableSize.Height; } overflowIndex++; } // Disconnect extra columns from the overflow chain, remove them from our private list // of columns, and remove them as children if (this._overflowColumns.Count > overflowIndex) { if (overflowIndex == 0) { this.RichTextContent.OverflowContentTarget = null; } else { this._overflowColumns[overflowIndex - 1].OverflowContentTarget = null; } while (this._overflowColumns.Count > overflowIndex) { this._overflowColumns.RemoveAt(overflowIndex); this.Children.RemoveAt(overflowIndex + 1); } } if (_Pages == null) { _Pages = new List <FrameworkElement>(_overflowColumns.Count + 1); } _Pages.Clear(); _Pages.Add(RichTextContent); _Pages.AddRange(_overflowColumns); if (Orientation == Windows.UI.Xaml.Controls.Orientation.Horizontal && HorizontalSnapPointsChanged != null) { HorizontalSnapPointsChanged(this, null); } if (Orientation == Windows.UI.Xaml.Controls.Orientation.Vertical && VerticalSnapPointsChanged != null) { VerticalSnapPointsChanged(this, null); } if (ColumnsChanged != null) { ColumnsChanged(this, null); } lastIdx = -1; // Report final determined size _measuredSize = new Size(maxWidth, maxHeight); return(_measuredSize); }
public MainPage() { InitializeComponent(); CrossConnectivity.Current.ConnectivityChanged += async(sender, args) => { if (!CrossConnectivity.Current.IsConnected && !wasNotConn) { wasNotConn = true; await Navigation.PushModalAsync(new NoConnection()); } else { wasNotConn = false; } }; NavigationPage.SetHasBackButton(this, false); NavigationPage.SetHasNavigationBar(this, false); Device.BeginInvokeOnMainThread(() => { var homePage = new HomePage(); var navigationHomePage = new NavigationPage(homePage); //navigationHomePage.Title = "Főmenü"; navigationHomePage.Icon = GlobalVariables.homepng; navigationHomePage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(homePage, false); var searchPage = new SearchPage(); var navigationSearchPage = new NavigationPage(searchPage); //navigationSearchPage.Title = "Keresés"; navigationSearchPage.Icon = GlobalVariables.searchpng; navigationSearchPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(searchPage, false); var peopleSearchPage = new PeopleSearchPage(); var navigationPeopleSearchPage = new NavigationPage(peopleSearchPage); //navigationMyAccountPage.Title = "Fiók"; navigationPeopleSearchPage.Icon = GlobalVariables.peoplepng; navigationPeopleSearchPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(peopleSearchPage, false); var uploadPhotoPage = new UploadPhotoPage(); var navigationUploadPhotoPage = new NavigationPage(uploadPhotoPage); //navigationUploadPhotoPage.Title = "Fotó"; navigationUploadPhotoPage.Icon = GlobalVariables.camerapng; navigationUploadPhotoPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(uploadPhotoPage, false); var myAccountPage = new MyAccountPage(); var navigationMyAccountPage = new NavigationPage(myAccountPage); //navigationMyAccountPage.Title = "Fiók"; navigationMyAccountPage.Icon = GlobalVariables.profilepng; navigationMyAccountPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(myAccountPage, false); Children.Add(navigationHomePage); Children.Add(navigationSearchPage); Children.Add(navigationPeopleSearchPage); Children.Add(navigationUploadPhotoPage); Children.Add(navigationMyAccountPage); }); }
private void Attach(PackagePart child) { child.Parent = this; Children.Add(child); }
internal void AddChild(BSProgressBar child) { Children.Add(child); NotifyChildren?.Invoke(); }
void ICollection <GraphicVisual> .Add(GraphicVisual item) { Children.Add(item); GraphicVisualGroupChildrenChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item)); }
public void AddChild(ObjectTreeNode node) { node.Parent = this; Children.Add(node); }
public PftTraceFunction(PftParser.TraceFunctionContext node) : base(node) { Argument = DispatchContext(node.nonGrouped()); Children.Add(Argument); }
private void AddDummy() { Children.Add(new DummyFileSystemObjectInfo()); }
public void Add(Entry e) { Children.Add(e); }
public override void OnPopulate() { #region Populate if (RootNode is ARCNode && (RootNode as ARCNode).IsFighter) { List <int> ActionOffsets; MoveDefActionListNode actions = new MoveDefActionListNode { _name = "Action Scripts", _parent = this }; bint *actionOffset; //Parse offsets first for (int i = 4; i < 6; i++) { actionOffset = (bint *)(BaseAddress + specialOffsets[i].Offset); ActionOffsets = new List <int>(); for (int x = 0; x < specialOffsets[i].Size / 4; x++) { ActionOffsets.Add(actionOffset[x]); } actions.ActionOffsets.Add(ActionOffsets); } //unk18 == ColorF4 int r = 0; foreach (SpecialOffset s in specialOffsets) { if (r != 4 && r != 5 && r != 6 && r != 7 && r != 11 && r != 17 && r != 19 && r != 20 && r != 21 && r != 22 && r != 23) { string name = "Params" + r; if (r < 4) { name = (r == 0 || r == 2 ? "" : "SSE ") + (r < 2 ? "Global " : "") + "IC-Basics"; } new MoveDefSectionParamNode { _name = name, offsetID = r }.Initialize(this, BaseAddress + s.Offset, 0); } r++; } //Copy list of offset 19? //if (specialOffsets[6].Size != 0) // new MoveDefActionsNode("Flash Overlay Actions") { offsetID = 6 }.Initialize(this, BaseAddress + specialOffsets[6].Offset, 0); if (specialOffsets[7].Size != 0) { new MoveDefCommonUnk7ListNode { _name = "Unknown7", offsetID = 7 }.Initialize(this, BaseAddress + specialOffsets[7].Offset, 0); } if (specialOffsets[11].Size != 0) { new MoveDefUnk11Node { _name = "Unknown11", offsetID = 11 }.Initialize(this, BaseAddress + specialOffsets[11].Offset, 0); } if (specialOffsets[19].Size != 0) { (_flashOverlay = new MoveDefActionsSkipNode("Flash Overlay Actions") { offsetID = 19 }).Initialize( this, BaseAddress + specialOffsets[19].Offset, 0); } if (specialOffsets[20].Size != 0) { (_screenTint = new MoveDefActionsSkipNode("Screen Tint Actions") { offsetID = 20 }).Initialize(this, BaseAddress + specialOffsets[20].Offset, 0); } if (specialOffsets[21].Size != 0) { new MoveDefCommonUnk21Node { offsetID = 21 }.Initialize(this, BaseAddress + specialOffsets[21].Offset, 0); } if (specialOffsets[22].Size != 0) { new MoveDefParamListNode { _name = "Unknown22", offsetID = 22 }.Initialize(this, BaseAddress + specialOffsets[22].Offset, 0); } if (specialOffsets[23].Size != 0) { new MoveDefParamsOffsetNode { _name = "Unknown23", offsetID = 23 }.Initialize(this, BaseAddress + specialOffsets[23].Offset, 0); } if (specialOffsets[17].Size != 0) { new MoveDefPatternPowerMulNode { _name = "Unknown17", offsetID = 17 }.Initialize(this, BaseAddress + specialOffsets[17].Offset, 0); } if (specialOffsets[4].Size != 0 || specialOffsets[5].Size != 0) { int count; if (specialOffsets[4].Size == 0) { count = specialOffsets[5].Size / 4; } else { count = specialOffsets[4].Size / 4; } //Initialize using first offset so the node is sorted correctly actions.Initialize(this, BaseAddress + specialOffsets[4].Offset, 0); //Set up groups for (int i = 0; i < count; i++) { actions.AddChild(new MoveDefActionGroupNode { _name = "Action" + i }, false); } //Add children for (int i = 0; i < 2; i++) { if (specialOffsets[i + 4].Size != 0) { PopulateActionGroup(actions, actions.ActionOffsets[i], false, i); } } //Add to children (because the parent was set before initialization) Children.Add(actions); Root._actions = actions; } } #endregion SortChildren(); }
private void CompileXaml(string xaml) { var content = (View)XamlServices.Parse(xaml); Children.Add(content); }
protected override async Task OnParametersSetAsync() { _renderFragments = new QueryDictionary <RenderFragment>(); foreach (var column in GridComponent.Grid.Columns) { // Name must have a non empty value if (string.IsNullOrWhiteSpace(column.Name)) { column.Name = Guid.NewGuid().ToString(); } if (((ICGridColumn)column).SubGrids != null) { var values = ((ICGridColumn)column).GetSubGridKeyValues(Item); var grid = await((ICGridColumn)column).SubGrids(values.Values.ToArray(), true, true, true, true) as ICGrid; grid.Direction = GridComponent.Grid.Direction; grid.FixedValues = values; VariableReference reference = new VariableReference(); if (Children.ContainsKey(column.Name)) { Children[column.Name] = reference; } else { Children.Add(column.Name, reference); } if (_renderFragments.ContainsKey(column.Name)) { _renderFragments[column.Name] = CreateSubGridComponent(grid, reference); } else { _renderFragments.Add(column.Name, CreateSubGridComponent(grid, reference)); } } else if (column.UpdateComponentType != null) { VariableReference reference = new VariableReference(); if (Children.ContainsKey(column.Name)) { Children[column.Name] = reference; } else { Children.Add(column.Name, reference); } if (_renderFragments.ContainsKey(column.Name)) { _renderFragments[column.Name] = GridCellComponent <T> .CreateComponent(_sequence, GridComponent, column.UpdateComponentType, column, Item, null, true, reference); } else { _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence, GridComponent, column.UpdateComponentType, column, Item, null, true, reference)); } } } _tabGroups = GridComponent.Grid.Columns .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name))) .Select(r => r.TabGroup).Distinct(); _shouldRender = true; }
/// <summary> /// Determines whether additional overflow columns are needed and if existing columns can /// be removed. /// </summary> /// <param name="availableSize">The size of the space available, used to constrain the /// number of additional columns that can be created.</param> /// <returns>The resulting size of the original content plus any extra columns.</returns> protected override Size MeasureOverride(Size availableSize) { if (this.RichTextContent == null) { return(new Size(0, 0)); } // Make sure the RichTextBlock is a child, using the lack of // a list of additional columns as a sign that this hasn't been // done yet if (this._overflowColumns == null) { Children.Add(this.RichTextContent); this._overflowColumns = new List <RichTextBlockOverflow>(); } // Start by measuring the original RichTextBlock content this.RichTextContent.Measure(availableSize); var maxWidth = this.RichTextContent.DesiredSize.Width; var maxHeight = this.RichTextContent.DesiredSize.Height; var hasOverflow = this.RichTextContent.HasOverflowContent; // Make sure there are enough overflow columns int overflowIndex = 0; while (hasOverflow && maxWidth < availableSize.Width && this.ColumnTemplate != null) { // Use existing overflow columns until we run out, then create // more from the supplied template RichTextBlockOverflow overflow; if (this._overflowColumns.Count > overflowIndex) { overflow = this._overflowColumns[overflowIndex]; } else { overflow = (RichTextBlockOverflow)this.ColumnTemplate.LoadContent(); this._overflowColumns.Add(overflow); this.Children.Add(overflow); if (overflowIndex == 0) { this.RichTextContent.OverflowContentTarget = overflow; } else { this._overflowColumns[overflowIndex - 1].OverflowContentTarget = overflow; } } // Measure the new column and prepare to repeat as necessary overflow.Measure(new Size(availableSize.Width - maxWidth, availableSize.Height)); maxWidth += overflow.DesiredSize.Width; maxHeight = Math.Max(maxHeight, overflow.DesiredSize.Height); hasOverflow = overflow.HasOverflowContent; overflowIndex++; } // Disconnect extra columns from the overflow chain, remove them from our private list // of columns, and remove them as children if (this._overflowColumns.Count > overflowIndex) { if (overflowIndex == 0) { this.RichTextContent.OverflowContentTarget = null; } else { this._overflowColumns[overflowIndex - 1].OverflowContentTarget = null; } while (this._overflowColumns.Count > overflowIndex) { this._overflowColumns.RemoveAt(overflowIndex); this.Children.RemoveAt(overflowIndex + 1); } } // Report final determined size return(new Size(maxWidth, maxHeight)); }
public MyZXingOverlay() { BindingContext = this; //ColumnSpacing = 0; VerticalOptions = LayoutOptions.FillAndExpand; HorizontalOptions = LayoutOptions.FillAndExpand; RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(3, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); var boxview = new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }; var boxview2 = new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }; Children.Add(boxview, 0, 0); Children.Add(boxview2, 0, 2); SetColumnSpan(boxview, 5); SetColumnSpan(boxview2, 5); // Children.Add(boxview, 0, 3); Children.Add(new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }, 0, 1); Children.Add(new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }, 4, 1); //Children.Add(new BoxView //{ // VerticalOptions = LayoutOptions.Fill, // HorizontalOptions = LayoutOptions.FillAndExpand, // BackgroundColor = Color.Black, // Opacity = 0.7, //}, 0, 3); //Children.Add(new BoxView //{ // VerticalOptions = LayoutOptions.Fill, // HorizontalOptions = LayoutOptions.FillAndExpand, // BackgroundColor = Color.Black, // Opacity = 0.7, //}, 0, 2); var AbsoluteLayouts = new AbsoluteLayout(); var redline = new Image { Source = "saomiao.png" }; AbsoluteLayout.SetLayoutBounds(redline, new Rectangle(1, weizhi, 1, 1)); AbsoluteLayout.SetLayoutFlags(redline, AbsoluteLayoutFlags.SizeProportional); AbsoluteLayouts.Children.Add(redline); Children.Add(AbsoluteLayouts, 1, 1); SetColumnSpan(AbsoluteLayouts, 3); topText = new Label { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, AutomationId = "zxingDefaultOverlay_TopTextLabel", }; topText.SetBinding(Label.TextProperty, new Binding(nameof(TopText))); Children.Add(topText, 0, 0); SetColumnSpan(topText, 5); botText = new Label { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, AutomationId = "zxingDefaultOverlay_BottomTextLabel", }; botText.SetBinding(Label.TextProperty, new Binding(nameof(BottomText))); //Children.Add(botText, 0, 2); //SetColumnSpan(botText, 5); var MyStackLayout = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; flash = new Button { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, //HeightRequest = 3, Text = "按钮", TextColor = Color.White, BackgroundColor = Color.FromHex("7fadf7"), Opacity = 0.7, AutomationId = "zxingDefaultOverlay_FlashButton", }; flash.SetBinding(Button.IsVisibleProperty, new Binding(nameof(ShowFlashButton))); flash.SetBinding(Button.TextProperty, new Binding(nameof(ButtonText))); flash.Clicked += (sender, e) => { FlashButtonClicked?.Invoke(flash, e); }; MyStackLayout.Children.Add(botText); MyStackLayout.Children.Add(flash); Children.Add(MyStackLayout, 0, 2); SetColumnSpan(MyStackLayout, 5); //this.ColumnSpacing = 0; this.RowSpacing = 0; Device.StartTimer(TimeSpan.FromSeconds(0.2), () => { weizhi += 7; AbsoluteLayout.SetLayoutBounds(redline, new Rectangle(1, weizhi, 1, 1)); if (weizhi > 150) { weizhi = -100; } return true; }); }
private void ApplyNumbers() { // Toggle visibility var isLineNumberOn = (bool)textView.Options.GetOptionValue(DefaultTextViewHostOptions.LineNumberMarginName); this.Visibility = isLineNumberOn ? Visibility.Visible : Visibility.Hidden; // Get the visual styles var lineNumberColorScheme = formatMap.GetProperties("Line Number"); var backColor = (SolidColorBrush)lineNumberColorScheme[EditorFormatDefinition.BackgroundBrushId]; var foreColor = (SolidColorBrush)lineNumberColorScheme[EditorFormatDefinition.ForegroundBrushId]; var fontFamily = textView.FormattedLineSource.DefaultTextProperties.Typeface.FontFamily; var fontSize = textView.FormattedLineSource.DefaultTextProperties.FontRenderingEmSize; var currentLineDefinition = formatMap.GetProperties(CurrentLineFormatDefinition.Name); var currentLineBackColor = currentLineDefinition.GetValue <SolidColorBrush>(EditorFormatDefinition.BackgroundBrushId, defaultValue: backColor); var currentLineForeColor = currentLineDefinition.GetValue <SolidColorBrush>(EditorFormatDefinition.ForegroundBrushId, defaultValue: foreColor); // Setup line indexes var currentCursorLineNumber = CursorLineNumber; var viewTotalLines = textView.TextViewLines.Count; var totalLineCount = textView.TextSnapshot.LineCount; var numberCharactersLineCount = (totalLineCount == 0) ? 1 : (int)Math.Log10(totalLineCount) + 1 + 1; var formattedWidth = CalculateWidth(FormatNumber(numberCharactersLineCount, totalLineCount), fontFamily, fontSize); this.Width = isLineNumberOn ? formattedWidth : 0.0; this.Background = backColor; // Bail when line numbers are off if (!isLineNumberOn) { return; } foreach (TextBlock textblock in Children) { textBlockPool.PutObject(textblock); } Children.Clear(); var lineNumbers = BuildLineNumbers(currentCursorLineNumber, textView.VisualSnapshot.LineCount); var viewPortFirstLine = textView.TextSnapshot.GetLineNumberFromPosition(textView.TextViewLines.FirstVisibleLine.Start); var viewPortLastLine = textView.TextSnapshot.GetLineNumberFromPosition(textView.TextViewLines.LastVisibleLine.End) + 1; var cursorAbove = currentCursorLineNumber < viewPortFirstLine; var cursorBelow = currentCursorLineNumber > viewPortLastLine; int offset; if (cursorAbove) { var hiddenLines = CountHiddenLines(textView.Caret.Position.BufferPosition, textView.TextViewLines.FirstVisibleLine.Start); offset = viewPortFirstLine - hiddenLines - 1; } else if (cursorBelow) { var hiddenLines = CountHiddenLines(textView.TextViewLines.FirstVisibleLine.Start, textView.Caret.Position.BufferPosition); offset = viewPortFirstLine + hiddenLines - 1; } else { viewPortFirstLine = viewPortFirstLine == 0 ? 1 : viewPortFirstLine; var cursorViewPortLineIndex = currentCursorLineNumber - viewPortFirstLine; var hiddenLines = CountHiddenLines(textView.TextViewLines.FirstVisibleLine.Start, textView.Caret.ContainingTextViewLine.Start); offset = currentCursorLineNumber - cursorViewPortLineIndex + hiddenLines - 1; } offset = offset < 0 ? 0 : offset; var previousLineNumber = -1; var counter = 0; for (var i = 0; i < viewTotalLines; i++) { var lineForeColor = foreColor; var lineBackColor = backColor; var width = numberCharactersLineCount; var currentLoopLine = textView.TextSnapshot.GetLineFromPosition(textView.TextViewLines[i].Start); var currentLoopLineNumber = currentLoopLine.LineNumber; int?displayNumber; if (previousLineNumber == currentLoopLineNumber) { // line wrapped displayNumber = null; } else if (currentLoopLineNumber + 1 == currentCursorLineNumber || !HasFocus) { var indx = offset + counter; displayNumber = lineNumbers.Count - 1 >= indx ? lineNumbers[indx] : lineNumbers[i]; width = HasFocus ? numberCharactersLineCount * -1 : numberCharactersLineCount; counter += 1; if (HasFocus) { lineForeColor = currentLineForeColor; lineBackColor = currentLineBackColor; } } else { // cursor line - display real line number var indx = offset + counter; displayNumber = lineNumbers[indx]; counter += 1; } var lineNumber = ConstructLineNumber(displayNumber, width, fontFamily, fontSize, lineForeColor, lineBackColor); previousLineNumber = currentLoopLineNumber; var top = (textView.TextViewLines[i].TextTop - textView.ViewportTop); SetTop(lineNumber, top); Children.Add(lineNumber); } }
public void BuildTiles() { Children?.Clear(); RowDefinitions?.Clear(); if (ItemsSource != null) { var items = ItemsSource as IList ?? ItemsSource.ToList(); //var enumerable = tiles as IList ?? tiles.ToList(); var numberOfRows = Math.Ceiling(((double)items.Count / (int)MaxColumns)); for (var i = 0; i < numberOfRows; i++) { RowDefinitions?.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Auto) }); } for (var index = 0; index < items.Count; index++) { var column = index % (int)MaxColumns; var row = (int)Math.Floor(((double)index / (int)MaxColumns)); //var tile = BuildTile(items[index]); var tile = items[index]; //var buildTile = (Layout)Activator.CreateInstance(typeof(GridItemTemplate), tile); //buildTile.BackgroundColor = Color.Transparent; //buildTile.InputTransparent = false; //var tapGestureRecognizer = new TapGestureRecognizer //{ // Command = Command, // CommandParameter = tile, // NumberOfTapsRequired = 1, //}; //buildTile?.GestureRecognizers.Add(tapGestureRecognizer); Button b = null; if (tile is string) { b = new Button() { BackgroundColor = Color.FromHex((string)items[index]), Command = Command, CommandParameter = index, BorderRadius = 5, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; //Children?.Add(buildTile, column, row); Children?.Add(b, column, row); } else if (tile is FileImageSource) { CustomImageButton imageButton = new CustomImageButton() { Image = ((FileImageSource)items[index]), BackgroundColor = Color.Transparent, Command = Command, CommandParameter = index, BorderRadius = 5, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; Children?.Add(imageButton, column, row); } } this.BackgroundColor = Color.Transparent; this.InputTransparent = true; //var tapGestureRecognizer = new TapGestureRecognizer //{ // Command = Command, // CommandParameter = "123", // NumberOfTapsRequired = 1, //}; //this.GestureRecognizers.Add(tapGestureRecognizer); } }
public void AddChild(Source child) { Children.Add(child); child.Parent = this; }
protected override void Init() { Title = "Tabbed Page with List"; Children.Add(new ContentPage { Title = "Tab Two" }); Children.Add(new ListViewTest()); }
public CoreTabbedPageBase() { AutomationId = "TabbedPageRoot"; Device.StartTimer(TimeSpan.FromSeconds(6), () => { BarBackgroundColor = Color.Maroon; BarTextColor = Color.Yellow; Device.StartTimer(TimeSpan.FromSeconds(6), () => { BarBackgroundColor = Color.Default; BarTextColor = Color.Default; return(false); }); return(false); }); Children.Add(new CoreRootPage(this, NavigationBehavior.PushModalAsync) { Title = "Tab 1" }); Children.Add(new CoreRootPage(this, NavigationBehavior.PushModalAsync) { Title = "Tab 2" }); Children.Add(new NavigationPage(new Page()) { Title = "Rubriques", IconImageSource = "coffee.png", BarBackgroundColor = Color.Blue, BarTextColor = Color.Aqua }); Children.Add(new NavigationPage(new Page()) { Title = "Le Club" }); Children.Add(new NavigationPage(new Page { Title = "Bookmarks" }) { Title = "Bookmarks", }); if (On <Android>().GetMaxItemCount() > 5) { Children.Add(new NavigationPage(new Page { Title = "Alertes" }) { Title = "Notifications", }); Children.Add(new NavigationPage(new Page { Title = "My account" }) { Title = "My account", }); Children.Add(new NavigationPage(new Page { Title = "About" }) { Title = "About", }); } }
protected override void Init() { Title = "Contacts"; Children.Add(new ContactsPage()); }
protected override void Init() { On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); pageCountLabel = new Label() { AutomationId = "PageCount" }; var popButton1 = new Button() { Text = "Pop", BackgroundColor = Color.Blue }; popButton1.Clicked += (s, a) => Navigation.PopModalAsync(); var popButton2 = new Button() { Text = "Pop 2", BackgroundColor = Color.Blue }; popButton2.Clicked += (s, a) => Navigation.PopModalAsync(); var longerTest = new Button() { Text = "Manual Color Tests", BackgroundColor = Color.Blue }; Children.Add(new ContentPage() { Title = "Page 1", Content = popButton1, Icon = "coffee.png" }); Children.Add(new ContentPage() { Title = "Page 2", Content = popButton2, Icon = "bank.png" }); Button btnChangeBarText = null; Button btnChangeBarItemColorText = null; Button btnChangeBarSelectedItemColorText = null; Button btnAddPage = null; Button btnRemovePage = null; Label lblSuccess = new Label() { AutomationId = "Outcome" }; btnChangeBarText = new Button() { Text = "Change Bar Text", Command = new Command(() => { if (BarTextColor == Color.Default) { BarTextColor = Color.HotPink; btnChangeBarText.Text = $"Bar Text: HotPink"; } else { BarTextColor = Color.Default; btnChangeBarText.Text = $"Bar Text: Default"; } }) }; btnChangeBarItemColorText = new Button() { Text = "Change Item Color", Command = new Command(() => { #pragma warning disable CS0618 // Type or member is obsolete if (On <Android>().GetBarItemColor() == Color.Default) #pragma warning restore CS0618 // Type or member is obsolete { #pragma warning disable CS0618 // Type or member is obsolete On <Android>().SetBarItemColor(new Color(0, 255, 0, 128)); #pragma warning restore CS0618 // Type or member is obsolete btnChangeBarItemColorText.Text = $"Item Color: Less Green"; } else { #pragma warning disable CS0618 // Type or member is obsolete On <Android>().SetBarItemColor(Color.Default); #pragma warning restore CS0618 // Type or member is obsolete btnChangeBarItemColorText.Text = $"Item Color: Default"; } }) }; btnChangeBarSelectedItemColorText = new Button() { Text = "Change Selected Item Color", Command = new Command(() => { #pragma warning disable CS0618 // Type or member is obsolete if (On <Android>().GetBarSelectedItemColor() == Color.Default) #pragma warning restore CS0618 // Type or member is obsolete { #pragma warning disable CS0618 // Type or member is obsolete On <Android>().SetBarSelectedItemColor(Color.Green); #pragma warning restore CS0618 // Type or member is obsolete btnChangeBarSelectedItemColorText.Text = $"Selected Item Color: Green"; } else { #pragma warning disable CS0618 // Type or member is obsolete On <Android>().SetBarSelectedItemColor(Color.Default); #pragma warning restore CS0618 // Type or member is obsolete btnChangeBarSelectedItemColorText.Text = $"Selected Item Color: Default"; } }) }; btnAddPage = new Button() { Text = $"Add Page (more than {On<Android>().GetMaxItemCount()} will crash)", Command = new Command(() => { Children.Add(new ContentPage() { Content = new Label() { Text = (Children.Count + 1).ToString() }, Title = (Children.Count + 1).ToString(), Icon = "calculator.png" }); btnRemovePage.IsEnabled = true; }), AutomationId = "AddPage" }; btnRemovePage = new Button() { Text = "Remove Page", Command = new Command(() => { Children.Remove(Children.Last()); if (Children.Count == 3) { btnRemovePage.IsEnabled = false; } }), IsEnabled = false, AutomationId = "RemovePage" }; var layout = new StackLayout() { Children = { btnChangeBarText, new Button() { Text = "Change Bar Background Color", Command = new Command(() => { if (BarBackgroundColor == Color.Default) { BarBackgroundColor = Color.Fuchsia; } else { BarBackgroundColor = Color.Default; } }) }, btnAddPage, btnRemovePage, new Button() { Text = "Page Add/Remove Permutations", Command = new Command(() => { while (Children.Count > 3) { Children.Remove(Children.Last()); } Children.Insert(1, new ContentPage() { Icon = "bank.png" }); Children.Insert(1, new ContentPage() { Icon = "bank.png" }); int i = 0; Device.StartTimer(TimeSpan.FromSeconds(3), () => { if (i == 0) { // Ensure inserting didn't change current page if (CurrentPage != Children[4]) { throw new Exception("Inserting page caused Current Page to Change"); } Children.RemoveAt(1); } else if (i == 1) { // Ensure removing didn't change current page if (CurrentPage != Children[3]) { throw new Exception("Removing page caused Current Page to Change"); } Children.Insert(1, new ContentPage() { Icon = "bank.png" }); CurrentPage = Children[1]; } else if (i == 2) { if (CurrentPage != Children[1]) { throw new Exception("Current Page not correctly set to new page inserted"); } Children.RemoveAt(1); Children.RemoveAt(1); } else if (i == 3) { if (CurrentPage != Children[0]) { throw new Exception("Current Page not reset to Page one after Current Page was Removed"); } CurrentPage = Children.Last(); lblSuccess.Text = "Success"; } else if (i >= 4) { return(false); } i++; return(true); }); }) }, pageCountLabel, lblSuccess }, }; if (Device.RuntimePlatform == Device.Android) { layout.Children.Insert(1, btnChangeBarItemColorText); layout.Children.Insert(2, btnChangeBarSelectedItemColorText); } Children.Add(new ContentPage() { Title = "Test", Content = layout, Icon = "calculator.png" }); }
internal void AddViewToLayerList(View view) { Children.Add(view); }