I have my object that i want to insert into ObservableCollection
:
public ObservableCollection<MyData> collection{ get; set; }
this.DataContext = this;
collection= new ObservableCollection<MyData>();
Now here i have Array
with my objects:
MyData[] array...
So here i try to add 1 object into my ObservableCollection
collection.Add(array[0]);
And received the targetinvocationexception
exception
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll
Try it : (My answerd by this method) :
In outside scope,declare public :
In Contructor :
MyDataArray is :
In button for add to list :
MyData class is :