Class PlacementRegistry
Chooses the placement strategy for a container: the registration for the most derived of its types, or MarginPlacement when none matches.
public sealed class PlacementRegistry
- Inheritance
-
PlacementRegistry
- Inherited Members
- Extension Methods
Constructors
PlacementRegistry()
Initializes a new instance of the PlacementRegistry class with the built-in strategies: StackPanelPlacement for StackPanel and GridPlacement for Grid.
public PlacementRegistry()
Methods
Register(Type, IPlacementStrategy)
Registers the strategy for containerType and the containers derived from it, replacing any
earlier registration for that type.
public void Register(Type containerType, IPlacementStrategy strategy)
Parameters
containerTypeTypeThe container type; a UIElement.
strategyIPlacementStrategyThe strategy.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
containerTypeisn't a UIElement.
Register<TContainer>(IPlacementStrategy)
Registers the strategy for TContainer and the containers derived from it, replacing any
earlier registration for that type.
public void Register<TContainer>(IPlacementStrategy strategy) where TContainer : UIElement
Parameters
strategyIPlacementStrategyThe strategy.
Type Parameters
TContainerThe container type.
Resolve(UIElement)
Gets the strategy for container.
public IPlacementStrategy Resolve(UIElement container)
Parameters
containerUIElementThe container.
Returns
- IPlacementStrategy
The registered strategy for its most derived registered type, or the margin fallback.