I am trying to display a set of data using a DataTemplate
in an ItemsControl
, with the ItemsPanel
set as a uniform grid of size 3 x 3. The ItemsSource
of the ItemsControl
is set to bind to a CollectionViewSource
which filters the source collection based on a search term. This all works fine.
The list I am binding to is of an arbitrary size, but I only want 9 results to be displayed, but I can't for the life of me work out how to either:
a) limit the CollectionViewSource
to output the first 9 items
b) limit the UniformPanel
to only 3 x 3 and never to create new rows
c) limit the ItemsControl
to only allow 9 data templates to be created at once.
I'm really scratching my head because I'm sure this is a common databinding scenario but I can't find anything on the web about it.