Page 1 of 1
Notify Property Change for an Indexer
Posted: 03 Nov 2015, 12:31
by Faerdan
Hi all,
I have an indexer which I am successfully binding to, however I am unable to raise a PropertyChangeEvent as I do not know the indexer's property. The suggestions on WPF documentation is "Item[]", and while this doesn't raise an error (I think because the property Item is automatically created for indexers) it doesn't update the binding.
How do I notify of an indexer property change?
Thanks,
Mark
Re: Notify Property Change for an Indexer
Posted: 03 Nov 2015, 13:40
by sfernandez
Unfortunately it seems to be a bug, indexer properties are not responding to "Item[]" property changes, only IList collections are doing so right now
Could you please create a ticket in our bugtracker, we will try to solve it as soon as possible.
Re: Notify Property Change for an Indexer
Posted: 03 Nov 2015, 13:42
by Faerdan
Will do.
That leaves me in a bad place right now, is the only option I have to create a property for each entry I want to access?
Re: Notify Property Change for an Indexer
Posted: 03 Nov 2015, 13:53
by sfernandez
Which kind of keys are you using to access the indexer properties?
If they are ints you can use an ObservableCollection<T>, and if they are strings you can use a ResourceDictionary.
Re: Notify Property Change for an Indexer
Posted: 03 Nov 2015, 14:00
by Faerdan
Re: Notify Property Change for an Indexer
Posted: 03 Nov 2015, 14:27
by Faerdan
Which kind of keys are you using to access the indexer properties?
If they are ints you can use an ObservableCollection<T>, and if they are strings you can use a ResourceDictionary.
When I use the indexer, the indexer tries to get the required data using an Id. This data can come over the network, so it cannot be stored in an ObservableCollection or ResourceDictionary, at least not without a lot of questionable coding practices. Unless I am missing something?
Re: Notify Property Change for an Indexer
Posted: 10 Nov 2015, 09:45
by sfernandez
Ok, I understand now, if you cannot store the data coming from the network, ResourceDictionary won't be a solution, you are right.
Anyway, we are going to release soon a patch for the last version with the indexer notification issue solved

Re: Notify Property Change for an Indexer
Posted: 10 Nov 2015, 10:00
by Faerdan
I have written a bunch of properties to get around the issue for now, which is a lot of duplication really. I am looking forward to having the indexers working.
Thanks for the quick turnaround on the fix.
Re: Notify Property Change for an Indexer
Posted: 10 Nov 2015, 14:14
by jsantos
Solved in 1.2.5f8 released
Re: Notify Property Change for an Indexer
Posted: 18 Nov 2015, 02:51
by Scherub
Ha, I was already wondering whether this was a bug when I tried to use indexer the other week. But I couldn't be bothered and went a different route. But it's good to know it's solved now.
