Unable to cast object of type 'MS.Internal.NamedObject' to custom type

前端 未结 2 1624
不知归路
不知归路 2021-02-05 11:14

I am not new to WPF, but I can\'t figure out this problem:

I use an ObservableCollection that i bind to ComboBoxes, it\'s a

相关标签:
2条回答
  • 2021-02-05 11:41

    I've the same problem just now, and after I remove the static-ressource Style on the ItemContainerStyle and define it directly beneath ListBox, the problem went away.

    I had x:Name property on the elements in DataTemplate, and since I deleted them, the compilator didn't make it at all, probably. So I changed a way at all to make it sense.

    Hope this small trick will help you !

    0 讨论(0)
  • 2021-02-05 11:47
    1. No need to call RaisePropertyChanged for MyObsCollection, because ObservableCollection internal implements INotifiyProperty Changed.
    2. I think it is Crashing while assign the value(during set call), this will happen when you try to assign a collection of one type collection of another type. You have to create object of the MyCustomType and should be added to the MyObsCollection instead of directly assigning a collection of different type to MyObsCollection

    It would be great if could post the entire code or piece of code where u assign the or add objects to MyObsCollection

    0 讨论(0)
提交回复
热议问题