/// <summary>Create a <see cref="Xaml.Controls.TextBlock"/></summary>
        /// <remarks>Remark: TextBlock().Bind() binds to <see cref="Xaml.Controls.TextBlock.TextProperty"/></remarks>
        public static TextBlock TextBlock(params CSharpMarkup.WinUI.InlineCollectionItem[] Inlines) // In UnoWinUI this method is not generated automatically because there the TextBlock ContentProperty is Text, not Inlines as it is in WinUI
        {
            var ui = new Xaml.Controls.TextBlock();

            for (int i = 0; i < Inlines.Length; i++)
            {
                var child = Inlines[i];
                if (child == null)
                {
                    continue;
                }

                var subChildren = Spreader <CSharpMarkup.WinUI.InlineCollectionItem> .ExtractChildren(child);

                if (subChildren != null)
                {
                    for (int j = 0; j < subChildren.Length; j++)
                    {
                        ui.Inlines.Add(subChildren[j]);
                    }
                }
                else
                {
                    ui.Inlines.Add(child);
                }
            }
            return(global::CSharpMarkup.WinUI.TextBlock.StartChain(ui));
        }
Beispiel #2
0
 /// <summary>Insert <paramref name="children"/> of type class <typeparamref name="TChild"/> in the parent layout's children at the position where <see cref="Spread{TChild}(TChild[])"/> is called</summary>
 /// <typeparam name="TChild">Must be a class; for struct types, use <see cref="SpreadS{TChild}(TChild[])"/></typeparam>
 public static TChild Spread <TChild>(IEnumerable <TChild> children) where TChild : class => Spreader <TChild> .Spread(children.ToArray());
Beispiel #3
0
 /// <summary>Insert <paramref name="children"/> of type class <typeparamref name="TChild"/> in the parent layout's children at the position where <see cref="Spread{TChild}(TChild[])"/> is called</summary>
 /// <typeparam name="TChild">Must be a class; for struct types, use <see cref="SpreadS{TChild}(TChild[])"/></typeparam>
 public static TChild Spread <TChild>(TChild[] children) where TChild : class => Spreader <TChild> .Spread(children);