BudgetAnalyser.LedgerBook.LedgerBookGridBuilderV2.AddContentToGrid C# (CSharp) 메소드

AddContentToGrid() 개인적인 메소드

private AddContentToGrid ( FrameworkElement parent, string content, int &gridRow, int gridColumn, string style, string tooltip = null ) : System.Windows.Controls.TextBlock
parent System.Windows.FrameworkElement
content string
gridRow int
gridColumn int
style string
tooltip string
리턴 System.Windows.Controls.TextBlock
        private TextBlock AddContentToGrid(FrameworkElement parent, string content, ref int gridRow, int gridColumn, string style, string tooltip = null)
        {
            var panel = parent as Panel;
            var decorator = parent as Decorator;

            var textBlock = new TextBlock
            {
                Style = (Style)FindResource(style),
                Text = content,
                ToolTip = tooltip ?? content
            };
            Grid.SetColumn(textBlock, gridColumn);
            Grid.SetRow(textBlock, gridRow++);
            if (panel != null)
            {
                panel.Children.Add(textBlock);
            }
            else if (decorator != null)
            {
                decorator.Child = textBlock;
            }
            else
            {
                throw new ArgumentException(nameof(parent) + " is not a Panel nor a Decorator", nameof(parent));
            }

            return textBlock;
        }