Browse Source

Last fix was not correct -> We don't know the Type of the Insert Object

pull/633/head
jkuehner 11 years ago
parent
commit
47a67fe2d7
  1. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs

@ -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,

Loading…
Cancel
Save