Class DelayedRegionCreationBehavior
Behavior that creates a new IRegion, when the control that will host the IRegion (see TargetElement) is added to the VisualTree. This behavior will use the RegionAdapterMappings class to find the right type of adapter to create the region. After the region is created, this behavior will detach.
Namespace: Sartorius.SAF.Presentation.Regions.Behaviors
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public class DelayedRegionCreationBehavior
Remarks
Attached property value inheritance is not available in Silverlight, so the current approach walks up the visual tree when requesting a region from a region manager. The Sartorius.SAF.Presentation.Regions.Behaviors.RegionManagerRegistrationBehavior is now responsible for walking up the Tree.
Constructors
View SourceDelayedRegionCreationBehavior(RegionAdapterMappings)
Initializes a new instance of the DelayedRegionCreationBehavior class.
Declaration
public DelayedRegionCreationBehavior(RegionAdapterMappings regionAdapterMappings)
Parameters
Type | Name | Description |
---|---|---|
RegionAdapterMappings | regionAdapterMappings | The region adapter mappings, that are used to find the correct adapter for
a given control type. The control type is determined by the |
Properties
View SourceTargetElement
The element that will host the Region.
Declaration
public DependencyObject TargetElement { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DependencyObject | The target element. |
Methods
View SourceAttach()
Start monitoring the RegionManager and the TargetElement to detect when the TargetElement becomes part of the Visual Tree. When that happens, the Region will be created and the behavior will Detach().
Declaration
public void Attach()
CreateRegion(DependencyObject, String)
Method that will create the region, by calling the right IRegionAdapter.
Declaration
protected virtual IRegion CreateRegion(DependencyObject targetElement, string regionName)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | targetElement | The target element that will host the IRegion. |
System.String | regionName | Name of the region. |
Returns
Type | Description |
---|---|
IRegion | The created IRegion |
Detach()
Stop monitoring the RegionManager and the TargetElement, so that this behavior can be garbage collected.
Declaration
public void Detach()
OnUpdatingRegions(Object, EventArgs)
Called when the RegionManager is updating it's Regions collection.
Declaration
public void OnUpdatingRegions(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The RegionManager. |
System.EventArgs | e | The System.EventArgs instance containing the event data. |
Remarks
This method has to be public, because it has to be callable using weak references in silverlight and other partial trust environments.