Really the subject says it all.
<CollectionViewSource x:Key="MyData"
Source="{Binding}" Filter="{ SomethingMagicInXaml? }" />
It’s not that I can’t have code behind. It just nags at me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do pretty much anything in XAML if you “try hard enough”, up to writing whole programs in it.
You will never get around code behind (well, if you use libraries you don’t have to write any but the application still relies on it of course), here’s an example of what you can do in this specific case:
Markup extensions are your friend if you want to do something in XAML.
(You might want to spell out the name of the extension, i.e.
me:FilterExtensionas the on-the-fly checking in Visual Studio may complain without reason, it still compiles and runs of course but the warnings might be annoying.Also do not expect the
CollectionViewSource.Filterto show up in the IntelliSense, it does not expect you to set that handler via XML-element-notation)