Click or drag to resize
weroSoft AG, Software
WindowPositionBehavior Class
The documentation is integral part of the weroSoft product documentation. This part is intended to be used by developers only.
Provides a behavior for window positioning and persistence of window positions.
Inheritance Hierarchy
SystemObject
  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      System.WindowsFreezable
        System.Windows.Media.AnimationAnimatable
          Behavior
            BehaviorWindow
              WeroSoft.Triton.Desktop.BehaviorsWindowPositionBehavior

Namespace:  WeroSoft.Triton.Desktop.Behaviors
Assembly:  WeroSoft.Triton.Desktop.Library (in WeroSoft.Triton.Desktop.Library.dll) Version: 3.23.1.1 (3.23.0205.1)
Syntax
C#
public sealed class WindowPositionBehavior : Behavior<Window>
Remarks
This behavior automatically loads and saves the position and size of windows to the Triton main settings. Note that, you should not use this behavior for plug-in windows, because there position and size is already tracked by Triton itself. Best usage of this behavior is on separate modal or non-modal windows in editors.
Examples
For adding this behavior to a dialog you must add the behavior to the window of your choice. The sample below shows how you can add the behavior. You must add an Owner name and a WindowName which are in combination unique.

Ensure that the XML-namespaces i (System.Windows.Interactivity) and behavior (WeroSoft.Triton.Desktop.Behaviors) are added to the windows base definition.

For first usage (no persistent data are available), the behavior automatically sets the window position to Left=200 Top=200 and takes the Width and Height from the window definition in XAML (see example below).
<dx:DXWindow x:Class="WeroSoft.Workflow.Visualization.DialogEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:ctrls="clr-namespace:WeroSoft.Windows.Controls;assembly=WeroSoft.Client.Library"
             xmlns:localRes="clr-namespace:WeroSoft.Workflow.Desktop.Properties"
             xmlns:cmnRes="clr-namespace:WeroSoft.Resources;assembly=WeroSoft.Resource.Library"
             xmlns:res="clr-namespace:WeroSoft.Resources.Accessors;assembly=WeroSoft.Resource.Library"
             xmlns:behavior="clr-namespace:WeroSoft.Triton.Desktop.Behaviors;assembly=WeroSoft.Triton.Desktop.Library"
             WindowStartupLocation="Manual"
             ShowInTaskbar="False"
             WindowStyle="ToolWindow"
             Background="White"
             Name="this"
             Title="{x:Static localRes:Resources.DialogEditorTitle}"
             Height="600" MinHeight="350" Width="800" MinWidth="500">

    <i:Interaction.Behaviors>
        <behavior:WindowPositionBehavior OwnerName="WorkflowSystem" WindowName="DialogEditor"/>
    </i:Interaction.Behaviors>

    ... add your content XAML here

The WindowPositionBehavior type exposes the following members.

Constructors
  NameDescription
Public methodWindowPositionBehavior
Initializes a new instance of the WindowPositionBehavior class
Top
Properties
  NameDescription
Public propertyCanFreeze
Gets a value that indicates whether the object can be made unmodifiable.
(Inherited from Freezable.)
Public propertyDependencyObjectType
Gets the DependencyObjectType that wraps the CLR type of this instance. 
(Inherited from DependencyObject.)
Public propertyDispatcher
Gets the Dispatcher this DispatcherObject is associated with.
(Inherited from DispatcherObject.)
Public propertyHasAnimatedProperties
Gets a value that indicates whether one or more AnimationClock objects is associated with any of this object's dependency properties.
(Inherited from Animatable.)
Public propertyIsFrozen
Gets a value that indicates whether the object is currently modifiable.
(Inherited from Freezable.)
Public propertyIsSealed
Gets a value that indicates whether this instance is currently sealed (read-only).
(Inherited from DependencyObject.)
Public propertyOwnerName
Gets or sets the owner of the behavior.
Public propertyWindowName
Gets or sets the WindowName of the behavior.
Top
Methods
  NameDescription
Public methodApplyAnimationClock(DependencyProperty, AnimationClock)
Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the SnapshotAndReplace handoff behavior is used.
(Inherited from Animatable.)
Public methodApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)
Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the specified HandoffBehavior is used.
(Inherited from Animatable.)
Public methodAttach (Inherited from Behavior.)
Public methodBeginAnimation(DependencyProperty, AnimationTimeline)
Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the SnapshotAndReplace handoff behavior is used.
(Inherited from Animatable.)
Public methodBeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)
Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the specified HandoffBehavior is used.
(Inherited from Animatable.)
Public methodClearValue(DependencyProperty)
Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier.
(Inherited from DependencyObject.)
Public methodClearValue(DependencyPropertyKey)
Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey.
(Inherited from DependencyObject.)
Public methodClone
Creates a modifiable clone of this Animatable, making deep copies of this object's values. When copying this object's dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values.
(Inherited from Animatable.)
Public methodCloneCurrentValue
Creates a modifiable clone (deep copy) of the Freezable using its current values.
(Inherited from Freezable.)
Public methodCoerceValue
Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.
(Inherited from DependencyObject.)
Public methodDetach (Inherited from Behavior.)
Public methodEquals
Determines whether a provided DependencyObject is equivalent to the current DependencyObject.
(Inherited from DependencyObject.)
Public methodFreeze
Makes the current object unmodifiable and sets its IsFrozen property to true.
(Inherited from Freezable.)
Public methodGetAnimationBaseValue
Returns the non-animated value of the specified DependencyProperty.
(Inherited from Animatable.)
Public methodGetAsFrozen
Creates a frozen copy of the Freezable, using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference.
(Inherited from Freezable.)
Public methodGetCurrentValueAsFrozen
Creates a frozen copy of the Freezable using current property values. Because the copy is frozen, any frozen sub-objects are copied by reference.
(Inherited from Freezable.)
Public methodGetHashCode
Gets a hash code for this DependencyObject.
(Inherited from DependencyObject.)
Public methodGetLocalValueEnumerator
Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.
(Inherited from DependencyObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue
Returns the current effective value of a dependency property on this instance of a DependencyObject.
(Inherited from DependencyObject.)
Public methodInvalidateProperty
Re-evaluates the effective value for the specified dependency property
(Inherited from DependencyObject.)
Public methodReadLocalValue
Returns the local value of a dependency property, if it exists.
(Inherited from DependencyObject.)
Public methodSetCurrentValue
Sets the value of a dependency property without changing its value source.
(Inherited from DependencyObject.)
Public methodSetValue(DependencyProperty, Object)
Sets the local value of a dependency property, specified by its dependency property identifier.
(Inherited from DependencyObject.)
Public methodSetValue(DependencyPropertyKey, Object)
Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.
(Inherited from DependencyObject.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Events
  NameDescription
Public eventChanged
Occurs when the Freezable or an object it contains is modified.
(Inherited from Freezable.)
Top
Fields
  NameDescription
Public fieldStatic memberOwnerNameProperty
Gets a DependencyProperty as the backing store for Owner. This enables animation, styling, binding, etc...
Public fieldStatic memberWindowNameProperty
Gets a DependencyProperty as the backing store for WindowName. This enables animation, styling, binding, etc...
Top
Extension Methods
  NameDescription
Public Extension MethodClone(CloneWorkingMode, IEnumerableType)Overloaded.
Clones an object by serialization.
(Defined by RuntimeExtensions.)
Public Extension MethodCloneT(CloneWorkingMode, IEnumerableType)Overloaded.
Clones an object by serialization.
(Defined by RuntimeExtensions.)
Public Extension MethodConvert (Defined by DataConverterExtensions.)
Public Extension MethodCreateTraceDataEntry(StringBuilder, SourceLevels, TraceableKind, String)Overloaded.
Creates a data entry into a string builder according to the giving parameters.
(Defined by TraceExtensions.)
Public Extension MethodCreateTraceDataEntry(SourceLevels, TraceableKind, String, String, Int32)Overloaded.
Creates a trace entry for a data element.
(Defined by TraceExtensions.)
Public Extension MethodCreateTraceDataEntry(StringBuilder, SourceLevels, TraceableKind, String, String, Int32)Overloaded.
Creates a trace entry into a string builder.
(Defined by TraceExtensions.)
Public Extension MethodDynamicCast
Dynamically casts a reference to another type.
(Defined by TypeManagerHelper.)
Public Extension MethodExtractSystemParametersFromTrigger
Extracts the system parameters from a collection of trigger parameter and transform them to a dictionary using string keys and string values.
(Defined by TriggerExtensions.)
Public Extension MethodGetFieldValue(String)Overloaded.
Gets the data object held by a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodGetFieldValueT(String)Overloaded.
Gets the data object held by a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodGetParentDependencyObjectOfType
Extension method for dependency objects to resolve a parent of a defined type.
(Defined by WindowsHelper.)
Public Extension MethodGetPropertyValue(String)Overloaded.
Gets the data object held by a defined property of a particular type.
(Defined by UnitTest.)
Public Extension MethodGetPropertyValueT(String)Overloaded.
Gets the data object held by a defined property of a particular type.
(Defined by UnitTest.)
Public Extension MethodInject(Type, Object)Overloaded.
Injects all fields or properties which are marked with the defined attribute type name.
(Defined by DataInjection.)
Public Extension MethodInject(Type, Object, Boolean)Overloaded.
Injects all fields or properties which are marked with the defined attribute type name.
(Defined by DataInjection.)
Public Extension MethodInjectField
Injects a value to a property within a data object.
(Defined by DataInjection.)
Public Extension MethodInjectProperty(String, Object)Overloaded.
Injects a value to a property within a data object.
(Defined by DataInjection.)
Public Extension MethodInjectProperty(String, Type, Object)Overloaded.
Injects a value to a property within a data object.
(Defined by DataInjection.)
Public Extension MethodInvoke(String, Object)Overloaded.
Invokes a method on an object by reflection.
(Defined by UnitTest.)
Public Extension MethodInvokeTResult(String, Object)Overloaded.
Invokes a method on an object by reflection.
(Defined by UnitTest.)
Public Extension MethodSetFieldValue
Sets the data object on a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodSetPropertyValue
Sets the data object on a defined property of a particular type.
(Defined by UnitTest.)
Public Extension MethodSetReadOnlyFieldValue
Sets the data object on a defined field of a particular type.
(Defined by UnitTest.)
Public Extension MethodTryInjectProperty
Tries to Inject a value to a property within a data object.
(Defined by DataInjection.)
Top
See Also