Exemple #1
0
        private void RenderTextBlock(XTextBlock textBlock)
        {
            var lines = textBlock.Text?.ToString().Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

            if (lines == null)
            {
                return;
            }
            int row = _rowCounter;

            foreach (var line in lines)
            {
                var label = new Label(line)
                {
                    X = Pos.Left(this) + textBlock.Left,
                    Y = Pos.Top(this) + row,
                };
                SetWidth(label, textBlock);
                Add(label);
                ++row;
            }
            _rowCounter = row;
        }
        internal void RenderTextBlock(XTextBlock textBlock, Window root, ref int row)
        {
            var lines = textBlock.Text?.ToString().Split('\n');

            if (lines == null)
            {
                return;
            }
            foreach (var line in lines)
            {
                if (string.IsNullOrWhiteSpace(line))
                {
                    continue;
                }

                var label = new Label(line)
                {
                    X = Pos.Left(root) + textBlock.Left,
                    Y = Pos.Top(root) + row,
                };
                root.Add(label);
                ++row;
            }
        }