0

To raise a PropertyChanged event for an indexer and a particular index value, do this:

OnPropertyChanged(string.Format(CultureInfo.CurrentCulture, "Item[{0}]", indexValue));

But what if the indexer accepts multiple index values? Rather than Item[{0}], what should the format string look like? Is it Item[{0},{1},{3}] or perhaps Item[{0}][{1}][{3}]?

HappyNomad
  • 4,458
  • 4
  • 36
  • 55
  • 1
    I'm pretty sure it would be `Item[{0},{1}...]` because the second case is a jagged style indexing, or think of it as "array of arrays". Your class would only take the first argument, then whatever it returned would index on the second, and so-forth. If your class handles all the indexes, then the proper format would be the first one. – Ron Beyer Jul 16 '15 at 18:29
  • @RonBeyer Right, `Item[{0},{1},{3}]` has to be it. – HappyNomad Jul 18 '15 at 09:02

1 Answers1

0

I've had something similar where I passed in multiple values to a function that was subscribed to OnPropertyChanged and just used some char to parse the items.

If I understand correctly you're just trying to get those values correct?

You could do:

 OnPropertyChanged(string.Format(CultureInfo.CurrentCulture, "Item[{0}];Item[{1}];Item[{2}]", indexValue, indexValue1, indexValue2));

Then just parse on ; using:

string[] stringArray = yourString.Split(';')

Hope that helps