Table of Contents

Class ControlFactory

Namespace
BSGameLib.UI.Controls
Assembly
BSGameLib.UI.dll

Creates the controls of a view from the models read from its view file.

public class ControlFactory : IControlFactory
Inheritance
ControlFactory
Implements
Inherited Members

Constructors

ControlFactory(ILogger, ITextureModelLoader, IThemeResourceStore)

Creates the factory. Created by dependency injection.

public ControlFactory(ILogger logger, ITextureModelLoader textureModelLoader, IThemeResourceStore themeResourceStore)

Parameters

logger ILogger
textureModelLoader ITextureModelLoader
themeResourceStore IThemeResourceStore

Methods

Create(View, Control, string)

Builds any control from its model - the one place that maps a schema element to a runtime control.

public UIElement Create(View view, Control model, string containerDescription = null)

Parameters

view View
model Control
containerDescription string

Returns

UIElement

Remarks

There used to be a hand-written copy of this switch in each container (stack, grid cell, dock), and they had silently drifted: the grid's threw NotSupportedException rather than warning, and omitted CheckBox and RadioButton entirely, so putting a checkbox in a grid cell took the whole view down. One dispatcher means a new element type becomes available everywhere at once, which is also what lets a repeater's item template hold anything a layout can.

Create(View, Decoration)

Creates a Decoration from its view-file model.

public Decoration Create(View view, Decoration model)

Parameters

view View
model Decoration

Returns

Decoration

Create(View, DockLayout)

Creates a DockLayout from its view-file model.

public DockLayout Create(View view, DockLayout model)

Parameters

view View
model DockLayout

Returns

DockLayout

Create(View, GridLayout)

Creates a Grid from its view-file grid model.

public Grid Create(View view, GridLayout model)

Parameters

view View
model GridLayout

Returns

Grid

Create(View, Label)

Creates a Label from its view-file model.

public Label Create(View view, Label model)

Parameters

view View
model Label

Returns

Label

Create(View, StackLayout)

Creates a StackLayout from its view-file model.

public StackLayout Create(View view, StackLayout model)

Parameters

view View
model StackLayout

Returns

StackLayout

Create(ILogger, View, Button)

Creates a Button from its view-file model.

public Button Create(ILogger logger, View view, Button model)

Parameters

logger ILogger
view View
model Button

Returns

Button

Create(ILogger, View, CheckBox)

Creates a CheckBox from its view-file model.

public CheckBox Create(ILogger logger, View view, CheckBox model)

Parameters

logger ILogger
view View
model CheckBox

Returns

CheckBox

Create(ILogger, View, ComboBox)

Creates a ComboBox from its view-file model.

public ComboBox Create(ILogger logger, View view, ComboBox model)

Parameters

logger ILogger
view View
model ComboBox

Returns

ComboBox

Create(ILogger, View, Image)

Creates an ImageControl from its view-file model.

public ImageControl Create(ILogger logger, View view, Image model)

Parameters

logger ILogger
view View
model Image

Returns

ImageControl

Create(ILogger, View, PasswordBox)

Creates a TextBox that hides its text, from its view-file password box model.

public TextBox Create(ILogger logger, View view, PasswordBox model)

Parameters

logger ILogger
view View
model PasswordBox

Returns

TextBox

Create(ILogger, View, ProgressBar)

Creates a ProgressBar from its view-file model.

public ProgressBar Create(ILogger logger, View view, ProgressBar model)

Parameters

logger ILogger
view View
model ProgressBar

Returns

ProgressBar

Create(ILogger, View, RadioButton)

Creates a RadioButton from its view-file model.

public RadioButton Create(ILogger logger, View view, RadioButton model)

Parameters

logger ILogger
view View
model RadioButton

Returns

RadioButton

Create(ILogger, View, Repeater)

Creates a Repeater from its view-file model.

public Repeater Create(ILogger logger, View view, Repeater model)

Parameters

logger ILogger
view View
model Repeater

Returns

Repeater

Create(ILogger, View, Slider)

Creates a Slider from its view-file model.

public Slider Create(ILogger logger, View view, Slider model)

Parameters

logger ILogger
view View
model Slider

Returns

Slider

Create(ILogger, View, TextBox)

Creates a TextBox from its view-file model.

public TextBox Create(ILogger logger, View view, TextBox model)

Parameters

logger ILogger
view View
model TextBox

Returns

TextBox