Class OverlayEffectTriggerBehavior
Behavior for triggering an overlay effect that will exclude the associated element.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls.Behaviors
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
public class OverlayEffectTriggerBehavior : Behavior<FrameworkElement>, IAnimatable, IAttachedObject
Remarks
The overlay will be triggered if IsActive is true
and the Microsoft.Xaml.Behaviors.Behavior<T>.AssociatedObject is loaded and visible.
Examples
The following example shows how to enable an overlay effect for all windows from a view and sparing the associated element.
<controls:EditControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
IsEnabled="{Binding IsEditing}">
<b:Interaction.Behaviors>
<SAF:OverlayEffectTriggerBehavior IsActive="{Binding IsEditing}" />
</b:Interaction.Behaviors>
</controls:EditControl>
The following example shows how to enable an overlay effect for the source window from a view and sparing the associated element.
<controls:EditControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
IsEnabled="{Binding IsEditing}">
<b:Interaction.Behaviors>
<SAF:OverlayEffectTriggerBehavior IsActive="{Binding IsEditing}" OverlayType="SourceWindow" />
</b:Interaction.Behaviors>
</controls:EditControl>
The following example shows how to enable an overlay effect from a view and sparing an additional element.
<controls:EditControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
IsEnabled="{Binding IsEditing}">
<b:Interaction.Behaviors>
<SAF:OverlayEffectTriggerBehavior IsActive="{Binding IsEditing}" OverlayType="SourceWindow">
<SAF:ElementReference ElementName="details1" />
</SAF:OverlayEffectTriggerBehavior>
</b:Interaction.Behaviors>
</controls:EditControl>
<controls:DetailsControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
x:Name="details"
IsEnabled="{Binding IsEditing}" />
The following example shows how to enable an overlay effect from a view and sparing additional elements.
<controls:EditControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
IsEnabled="{Binding IsEditing}">
<b:Interaction.Behaviors>
<SAF:OverlayEffectTriggerBehavior IsActive="{Binding IsEditing}" OverlayType="SourceWindow">
<SAF:ElementReference ElementName="details1" />
<SAF:ElementReference ElementName="details2" />
</SAF:OverlayEffectTriggerBehavior>
</b:Interaction.Behaviors>
</controls:EditControl>
<controls:DetailsControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
x:Name="details1"
IsEnabled="{Binding IsEditing}" />
<controls:DetailsControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
x:Name="details2"
IsEnabled="{Binding IsEditing}" />
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>
Constructors
View SourceOverlayEffectTriggerBehavior()
Initializes a new instance of the OverlayEffectTriggerBehavior class.
Declaration
public OverlayEffectTriggerBehavior()
Fields
View SourceAdditionalExcludedElementsProperty
Identifies the System.Windows.DependencyProperty for the AdditionalExcludedElements.
Declaration
public static readonly DependencyProperty AdditionalExcludedElementsProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
IsActiveProperty
Identifies the System.Windows.DependencyProperty for IsActive.
Declaration
public static readonly DependencyProperty IsActiveProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
OverlayTypeProperty
Identifies the System.Windows.DependencyProperty for OverlayType
Declaration
public static readonly DependencyProperty OverlayTypeProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty |
Properties
View SourceAdditionalExcludedElements
Gets the additional excluded elements.
Declaration
public IList AdditionalExcludedElements { get; }
Property Value
Type | Description |
---|---|
System.Collections.IList | The additional excluded elements. |
Remarks
Use the ElementReference markup extension to provide FrameworkElement references in xaml.
Examples
The following example shows how to enable an overlay effect from a view and sparing additional elements.
<controls:EditControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
IsEnabled="{Binding IsEditing}">
<b:Interaction.Behaviors>
<SAF:OverlayEffectTriggerBehavior IsActive="{Binding IsEditing}" OverlayType="SourceWindow">
<SAF:ElementReference ElementName="details1" />
<SAF:ElementReference ElementName="details2" />
</SAF:OverlayEffectTriggerBehavior>
</b:Interaction.Behaviors>
</controls:EditControl>
<controls:DetailsControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
x:Name="details1"
IsEnabled="{Binding IsEditing}" />
<controls:DetailsControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
x:Name="details2"
IsEnabled="{Binding IsEditing}" />
See Also
View SourceIsActive
Gets or sets a value indicating whether the overlay effect is active.
Declaration
public bool IsActive { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
The following example shows how to enable an overlay effect by binding IsActive to a value in the view model.
<controls:EditControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
IsEnabled="{Binding IsEditing}">
<b:Interaction.Behaviors>
<SAF:OverlayEffectTriggerBehavior IsActive="{Binding IsEditing}" />
</b:Interaction.Behaviors>
</controls:EditControl>
View Source
OverlayType
Gets or sets the type of the overlay.
Declaration
public OverlayType OverlayType { get; set; }
Property Value
Type | Description |
---|---|
OverlayType | The type of the overlay. |
Examples
The following example shows how to set OverlayType to SourceWindow to apply the overlay effect to the source window only.
<controls:EditControl xmlns:controls="clr-namespace:Sartorius.SAF.Documentation.Examples.Effects.Controls"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
IsEnabled="{Binding IsEditing}">
<b:Interaction.Behaviors>
<SAF:OverlayEffectTriggerBehavior IsActive="{Binding IsEditing}" OverlayType="SourceWindow" />
</b:Interaction.Behaviors>
</controls:EditControl>
See Also
Methods
View SourceOnAttached()
Called after the behavior is attached to an AssociatedObject.
Declaration
protected override void OnAttached()
Overrides
Remarks
Override this to hook up functionality to the AssociatedObject.
OnDetaching()
Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred.
Declaration
protected override void OnDetaching()
Overrides
Remarks
Override this to unhook functionality from the AssociatedObject.