Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
OnEventSetPropertyBehavior.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System.Windows;
4 
5 namespace SiliconStudio.Presentation.Behaviors
6 {
7  /// <summary>
8  /// An implementation of the <see cref="OnEventBehavior"/> class that allows to set the value of a dependency property
9  /// on the control hosting this behavior when a specific event is raised.
10  /// </summary>
12  {
13  /// <summary>
14  /// Identifies the <see cref="Property"/> dependency property.
15  /// </summary>
16  public static readonly DependencyProperty PropertyProperty = DependencyProperty.Register("Property", typeof(DependencyProperty), typeof(OnEventSetPropertyBehavior));
17 
18  /// <summary>
19  /// Identifies the <see cref="Value"/> dependency property.
20  /// </summary>
21  public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(OnEventSetPropertyBehavior));
22 
23  /// <summary>
24  /// Gets or sets the <see cref="DependencyProperty"/> to set when the event is raised.
25  /// </summary>
26  public DependencyProperty Property { get { return (DependencyProperty)GetValue(PropertyProperty); } set { SetValue(PropertyProperty, value); } }
27 
28  /// <summary>
29  /// Gets or sets the value to set when the event is raised.
30  /// </summary>
31  public object Value { get { return GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } }
32 
33  /// <inheritdoc/>
34  protected override void OnEvent()
35  {
36  AssociatedObject.SetCurrentValue(Property, Value);
37  }
38  }
39 }
An abstract behavior that allows to perform actions when an event is raised. It supports both RoutedE...
override void OnEvent()
Invoked when the monitored event is raised.
An implementation of the OnEventBehavior class that allows to set the value of a dependency property ...