Class OverlayEffect
Implements functionality to overlay wpf controls of type System.Windows.Window with a 'darken out' effect.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
public sealed class OverlayEffect : DependencyObject, IOverlayEffect
Remarks
The OverlayEffect is only applied to a System.Windows.Window that has a System.Windows.Controls.Grid as content.
The OverlayEffect is typically used when showing a modal dialog.
The instance of the OverlayEffect must be obtained using the System.ComponentModel.Composition.ImportingConstructorAttribute.
See IOverlayEffect or OverlayEffectTriggerBehavior for code examples.
Examples
The following example shows how a style can manipulate the layout of a control when it is overlaid by an OverlayEffect.
<Style x:Key="DataGridStyle" TargetType="DataGrid">
<Style.Triggers>
<Trigger Property="SAF:OverlayEffect.IsOverlayed" Value="True">
<Setter Property="IsEnabled" Value="False" />
<Setter Property="CellStyle" Value="{StaticResource OverlayedCellStyle}" />
</Trigger>
</Style.Triggers>
</Style>
Fields
View SourceIsAllowedProperty
Identifies the System.Windows.DependencyProperty for SetIsAllowed(Window, Boolean) and GetIsAllowed(Window).
Declaration
public static readonly DependencyProperty IsAllowedProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
IsOverlayedProperty
Identifies the System.Windows.DependencyProperty for the Sartorius.SAF.Effects.OverlayEffect.IsOverlayed attached property.
Declaration
public static readonly DependencyProperty IsOverlayedProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
Properties
View SourceInstance
Gets the singleton instance of the OverlayEffect class.
Declaration
public static IOverlayEffect Instance { get; }
Property Value
Type | Description |
---|---|
IOverlayEffect |
Methods
View SourceApply()
Applies an overlay effect to all application windows that don't have an overlay effect yet.
Declaration
public IDisposable Apply()
Returns
Type | Description |
---|---|
System.IDisposable | An instance of System.IDisposable that removes the effect on dispose. |
Remarks
Windows that have OverlayEffect.IsAllowed set to false
will not get overlaid.
Apply(OverlayArguments)
Applies an overlay according to the specified OverlayArguments.
Declaration
public IDisposable Apply(OverlayArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
OverlayArguments | arguments | The OverlayArguments that specify the scope of the overlay. |
Returns
Type | Description |
---|---|
System.IDisposable | An instance of System.IDisposable that removes the effect on dispose. |
Remarks
In MVVM scenarios consider to use the OverlayEffectTriggerBehavior.
See Also
View SourceGetIsAllowed(Window)
Gets a System.Boolean specifying whether the specified System.Windows.Window may be overlaid by an overlay effect.
Declaration
[AttachedPropertyBrowsableForType(typeof(Window))]
public static bool GetIsAllowed(Window window)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Window | window | The element. |
Returns
Type | Description |
---|---|
System.Boolean | a System.Boolean specifying whether the specified |
See Also
View SourceGetIsOverlayed(DependencyObject)
Gets a value indicating whether the element
is currently overlaid by an overlay effect.
Declaration
public static bool GetIsOverlayed(DependencyObject element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
SetIsAllowed(Window, Boolean)
Sets a System.Boolean specifying whether the specified System.Windows.Window may be overlaid by an overlay effect.
Declaration
[AttachedPropertyBrowsableForType(typeof(Window))]
public static void SetIsAllowed(Window window, bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Window | window | The window for which to set the Sartorius.SAF.Effects.OverlayEffect.IsAllowed property. |
System.Boolean | value | If set to |
Remarks
The default is true
.
When an overlay effect is configured to use the window as source window by setting SourceReference
and setting Type to SourceWindow this property will have no effect on
the overlay effect, and it will be applied to the window.