1
<ListView.Resources>
    <CollectionViewSource x:Key="adv" Source="{Binding Adventurers}">
        <CollectionViewSource.Filter>
        </CollectionViewSource.Filter>
    </CollectionViewSource>
</ListView.Resources>

The compiler gives me 2 errors when I attempt this:

"The member "Filter" is not recognized or is not accessible."

"Property 'Filter' does not have a value."

It does this regardless of where in the XAML I create the CollectionViewSource. Does anybody know what the problem could be?

For this project I'm trying to create my views in pure XAML. I would like to avoid code-behind if possible.

Update: I've been using the code in this answer as a guide: https://stackoverflow.com/a/6462282/1667020 - I have included everything from the answer into my code and I still have the same problem.

Community
  • 1
  • 1
Jason D
  • 2,634
  • 6
  • 33
  • 67
  • Did you create the `FilterExtension` class (and related classes) in your project per the answer's code? [`CollectionViewSource.Filter`](http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource.filter.aspx) is an event, so without a custom markup extension (like the one provided by the answer you referenced) you can't work with it in XAML. – Adam Maras Jun 01 '13 at 06:12
  • Yes, everything is there. – Jason D Jun 01 '13 at 06:37
  • Also, markup extensions for events are only supported on .NET 4.5. This won't work on any previous version of the framework, or in Silverlight. – Adam Maras Jun 01 '13 at 17:26
  • My project uses the 4.5 framework. – Jason D Jun 01 '13 at 17:32
  • Okay, obvious question now (based on your code snippet) is that the complete XAML you're trying to use? If so, you're (obviously) not using the markup extension, hence the error message. If not, post complete code. – Adam Maras Jun 04 '13 at 07:00
  • 1
    Was this ever resolved? I too used the same answer referenced as a guide, and whilst everything runs, in the designer it complains about not being able to assign to Filter. – Ray Hayes Jun 12 '16 at 15:41

0 Answers0