Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
BindingExtensions.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;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Reflection;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Data;
10 
11 namespace SiliconStudio.Presentation.Extensions
12 {
13  public static class BindingExtensions
14  {
15  private static readonly MethodInfo CloneMethodInfo = typeof(BindingBase).GetMethod("Clone", BindingFlags.Instance | BindingFlags.NonPublic);
16 
17  /// <summary>
18  /// This methods is a wrapper to the internal method Clone of the <see cref="BindingBase"/>. Using this method should be considered unsafe.
19  /// </summary>
20  /// <param name="bindingBase">The BindingBase to clone.</param>
21  /// <param name="mode">The BindingMode value to set for the clone.</param>
22  /// <returns>A clone of the given <see cref="BindingBase"/></returns>
23  public static BindingBase CloneBinding(this BindingBase bindingBase, BindingMode mode)
24  {
25  return (BindingBase)CloneMethodInfo.Invoke(bindingBase, new object[] { mode });
26  }
27  }
28 }
static BindingBase CloneBinding(this BindingBase bindingBase, BindingMode mode)
This methods is a wrapper to the internal method Clone of the BindingBase. Using this method should b...