Show / Hide Table of Contents

Method wpfBuilder.StartGrid(+ 2 overloads)


Overload

Adds System.Windows.Controls.Grid panel (table) that will contain elements added with wpfBuilder.Add etc. Finally call wpfBuilder.End to return to current panel.

public wpfBuilder StartGrid(bool childOfLast = false)
Parameters
childOfLast  (bool)

Add as child of wpfBuilder.Last, which can be of type (or base type):

  • System.Windows.Controls.ContentControl. Adds as its System.Windows.Controls.ContentControl.Content property. For example you can add a CheckBox in a Button.
  • System.Windows.Controls.Decorator, for example System.Windows.Controls.Border. Adds as its System.Windows.Controls.Decorator.Child property. .
Returns
wpfBuilder

Remarks

How wpfBuilder.Last changes: after calling this function it is the grid (wpfBuilder.Panel); after adding an element it is the element; finally, after calling End it is the grid if childOfLastfalse, else its parent. The same with all StartX functions.


Overload(next)

Adds a headered content control (System.Windows.Controls.GroupBox, System.Windows.Controls.Expander, etc) with child System.Windows.Controls.Grid panel (table) that will contain elements added with wpfBuilder.Add etc. Finally call wpfBuilder.End to return to current panel.

public wpfBuilder StartGrid<T>(object header) where T : HeaderedContentControl, new()
Parameters
header  (object)

Header text/content.

Returns
wpfBuilder
Type Parameters
T

Remarks

How wpfBuilder.Last changes: after calling this function it is the grid (wpfBuilder.Panel); after adding an element it is the element; finally, after calling End it is the content control (grid's parent). The same with all StartX functions.

Examples

b.StartGrid<GroupBox>("Group");

Overload(top)

Adds a headered content control (System.Windows.Controls.GroupBox, System.Windows.Controls.Expander, etc) with child System.Windows.Controls.Grid panel (table) that will contain elements added with wpfBuilder.Add etc. Finally call wpfBuilder.End to return to current panel.

public wpfBuilder StartGrid<T>(out T container, object header) where T : HeaderedContentControl, new()
Parameters
container  (T)

Receives the content control's variable. The function creates new control of the type.

header  (object)

Header text/content.

Returns
wpfBuilder
Type Parameters
T

Remarks

How wpfBuilder.Last changes: after calling this function it is the grid (wpfBuilder.Panel); after adding an element it is the element; finally, after calling End it is the content control (grid's parent). The same with all StartX functions.

Examples

b.StartGrid(out Expander g, "Expander"); g.IsExpanded=true;