|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | +using System.Threading.Tasks; |
| 6 | +using System.Windows; |
| 7 | + |
| 8 | +namespace EmptyKeys.UserInterface.Designer |
| 9 | +{ |
| 10 | + /// <summary> |
| 11 | + /// Implements attached properties for binding generator |
| 12 | + /// </summary> |
| 13 | + public sealed class GeneratedBindings |
| 14 | + { |
| 15 | + private static Type typeOfThis = typeof(GeneratedBindings); |
| 16 | + |
| 17 | + /// <summary> |
| 18 | + /// The data type property |
| 19 | + /// </summary> |
| 20 | + public static readonly DependencyProperty DataTypeProperty = |
| 21 | + DependencyProperty.RegisterAttached("DataType", typeof(Type), typeOfThis, |
| 22 | + new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None)); |
| 23 | + |
| 24 | + /// <summary> |
| 25 | + /// Gets the type of the data. |
| 26 | + /// </summary> |
| 27 | + /// <param name="obj">The object.</param> |
| 28 | + /// <returns></returns> |
| 29 | + public static Type GetDataType(DependencyObject obj) |
| 30 | + { |
| 31 | + return (Type)obj.GetValue(DataTypeProperty); |
| 32 | + } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// Sets the type of the data. |
| 36 | + /// </summary> |
| 37 | + /// <param name="obj">The object.</param> |
| 38 | + /// <param name="value">The value.</param> |
| 39 | + public static void SetDataType(DependencyObject obj, Type value) |
| 40 | + { |
| 41 | + obj.SetValue(DataTypeProperty, value); |
| 42 | + } |
| 43 | + |
| 44 | + |
| 45 | + /// <summary> |
| 46 | + /// The mode property |
| 47 | + /// </summary> |
| 48 | + public static readonly DependencyProperty ModeProperty = |
| 49 | + DependencyProperty.RegisterAttached("Mode", typeof(GeneratedBindingsMode), typeOfThis, |
| 50 | + new FrameworkPropertyMetadata(GeneratedBindingsMode.Generated)); |
| 51 | + |
| 52 | + /// <summary> |
| 53 | + /// Gets the mode. |
| 54 | + /// </summary> |
| 55 | + /// <param name="obj">The object.</param> |
| 56 | + /// <returns></returns> |
| 57 | + public static GeneratedBindingsMode GetMode(DependencyObject obj) |
| 58 | + { |
| 59 | + return (GeneratedBindingsMode)obj.GetValue(ModeProperty); |
| 60 | + } |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// Sets the mode. |
| 64 | + /// </summary> |
| 65 | + /// <param name="obj">The object.</param> |
| 66 | + /// <param name="value">The value.</param> |
| 67 | + public static void SetMode(DependencyObject obj, GeneratedBindingsMode value) |
| 68 | + { |
| 69 | + obj.SetValue(ModeProperty, value); |
| 70 | + } |
| 71 | + } |
| 72 | +} |
0 commit comments