I have quite a tricky problem:
I am using a ListView control with the ItemsSource set to a CollectionViewSource including a PropertyGroupDescription to group the Lis
You could create a new class with a Dictionary (say, ObjectType as a key to bool values), and give it an indexer:
Dictionary expandStates = new Dictionary();
public bool this[ObjectType key]
{
get
{
if (!expandStates.ContainsKey(key)) return false;
return expandStates[key];
}
set
{
expandStates[key] = value;
}
}
Then, instantiate it in a ResourceDictionary somewhere and bind the IsExpanded to it like this:
That might well do it: a nice way of getting WPF to call your code and pass a parameter just when you need it. (That WPF lets you put subexpressions in indexers in a binding path was news to me - good though isn't it!)