I found how to do it whilst reading this article:
http://www.dev102.com/2008/08/07/how-to-access-a-wpf-control-which-is-located-in-a-datatemplate/[
^]
All it takes is declaring a WrapPanel variable at the start of your code:
private WrapPanel wp = new WrapPanel();
And then hooking into the WrapPanel that already exists in your XAML, and accessing the Loaded event and casting the WrapPanel to tge variable just created:
private void wp_Loaded(object sender, RoutedEventArgs e)
{
wp = sender as WrapPanel;
}
Alot easier than I thought!