Some LINQ and WPF Basics

This evening I wanted to get back to my old habits of creating silly spike projects which just test out a particular piece of functionality/feature.

Tonight I have mixed together some WPF forms and binding with some LINQ queries i was learning.

Part 1 – WPF Forms and Binding
What I wanted to learn from this was to create my own ListBox with a custom drawn ListItem, and bind it to a simple List<String>. The catch was I wanted to do this without looking it up on the net thereby forcing myself to learn the framework and in particular the syntax around the Binding interpreter because there’s no IntelliSense for any Binding properties. The result XAML is below:

[HTML2]



Part 2 – LINQ Basics
Although I was watching the video, I went off and did my own thing for the most part, and was playing around with using LINQ to select a list of directories which matched a certain criteria. This sample demonstrated how to add any method as part of the filter condition for a LINQ query, and a brief touch on ordering.

[HTML1]



Part 3 – LINQ Objects

This idea is to use LINQ to return an anonymous type which is defined inline of the LINQ query itself. (ignore the bad naming convention, here 😉 )

[HTML3]



Part 4 – LINQ Grouping
This exercise was to play around with grouping of LINQ queries and the ways that you can select out of the grouped query result. I still haven’t got the knack of this one, just yet….

[HTML4]


That just about wraps it up for tonight….Not a bad way to spend my time offline

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>