Thursday, 12 September 2013

What's the LinqToXML xaml equivalent of .Distinct()?

What's the LinqToXML xaml equivalent of .Distinct()?

Here's the DisplayMemberPath property binding for my ListBox (I'm binding
to an ObservableCollection of XElements):
DisplayMemberPath="Element[Shape].Value"
I've used linq many times for parsing Entity Framework and Sql data, in
which case I would write the analogous binding:
DisplayMemberPath="PropertyName.Distinct()"
I don't want to filter my actual collection to only return Distinct
values--I want my full collection and only display distinct values to
mitigate collection building and PropertyChanged notifications.
Alternative thought: Could I use my ObservablecCollection "getter" to grab
the distinct values of the full list set in the setter? (Not sure if that
makes sense...) so the true collection remains non-distinct and the
displayed collection becomes distinct?

No comments:

Post a Comment