|
|
|
@ -21,6 +21,7 @@ using System.Diagnostics; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Globalization; |
|
|
|
using System.Globalization; |
|
|
|
|
|
|
|
using System.Linq; |
|
|
|
using System.Reflection; |
|
|
|
using System.Reflection; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows.Documents; |
|
|
|
using System.Windows.Documents; |
|
|
|
@ -107,10 +108,9 @@ namespace ICSharpCode.WpfDesign.XamlDom |
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static bool Insert(Type collectionType, object collectionInstance, XamlPropertyValue newElement, int index) |
|
|
|
public static bool Insert(Type collectionType, object collectionInstance, XamlPropertyValue newElement, int index) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var mth = collectionType.GetMethod("Insert", BindingFlags.Public | BindingFlags.Instance, |
|
|
|
var hasInsert = collectionType.GetMethods().Any(x => x.Name == "Insert"); |
|
|
|
null, CallingConventions.Any, new Type[]{ typeof(int), typeof(object) }, null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mth != null) { |
|
|
|
if (hasInsert) { |
|
|
|
collectionType.InvokeMember( |
|
|
|
collectionType.InvokeMember( |
|
|
|
"Insert", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, |
|
|
|
"Insert", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, |
|
|
|
null, collectionInstance, |
|
|
|
null, collectionInstance, |
|
|
|
|