Faerdan
Topic Author
Posts: 73
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Notify Property Change for an Indexer

03 Nov 2015, 12:31

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
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Notify Property Change for an Indexer

03 Nov 2015, 13:40

Unfortunately it seems to be a bug, indexer properties are not responding to "Item[]" property changes, only IList collections are doing so right now :oops:

Could you please create a ticket in our bugtracker, we will try to solve it as soon as possible.
 
Faerdan
Topic Author
Posts: 73
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Re: Notify Property Change for an Indexer

03 Nov 2015, 13:42

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?
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Notify Property Change for an Indexer

03 Nov 2015, 13:53

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.
 
Faerdan
Topic Author
Posts: 73
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Re: Notify Property Change for an Indexer

03 Nov 2015, 14:00

 
Faerdan
Topic Author
Posts: 73
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Re: Notify Property Change for an Indexer

03 Nov 2015, 14:27

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?
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Notify Property Change for an Indexer

10 Nov 2015, 09:45

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 ;)
 
Faerdan
Topic Author
Posts: 73
Joined: 02 Oct 2015, 09:11
Location: Galway, Ireland
Contact:

Re: Notify Property Change for an Indexer

10 Nov 2015, 10:00

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.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Notify Property Change for an Indexer

10 Nov 2015, 14:14

Solved in 1.2.5f8 released
 
User avatar
Scherub
Posts: 141
Joined: 06 May 2014, 20:53
Contact:

Re: Notify Property Change for an Indexer

18 Nov 2015, 02:51

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. :)

Who is online

Users browsing this forum: Ahrefs [Bot] and 54 guests