title: Implement DataTemplate DependencyProperty in UserControl
body: <p>I'm trying to make an intertia touch scrolling list in a UserControl in Silverlight 4 using Expression Blend 4. I've already made the dependency properties in my UserControl which i want to work like the ListBox does. ItemSource is the list of objects i want to show in my list and datatemplate is the way it should be shown. </p>
  
  <p>How do i deal with these properties inside my UserControl? I have a StackPanel where all the datatemplates should be added showing the data ofc. </p>
  
  <p>How do i apply the data in my IEnumerable to the DataTemplate when looping through the ItemSource to add them to the list (StackPanel).</p>
  
  <pre><code>        public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(InertiaScrollBox), null); 
      public IEnumerable ItemsSource
      {
          get{ return (IEnumerable)GetValue(ItemsSourceProperty); }
          set{ SetValue(ItemsSourceProperty, value); }
      }
  
      public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(InertiaScrollBox), null);
      public DataTemplate ItemTemplate
      {
          get { return (DataTemplate)GetValue(ItemTemplateProperty); }
          set { SetValue(ItemTemplateProperty, value); }
      }
  </code></pre>
  
  <p>This was kinda hard to explain but hope you understand otherwise please ask. Thanks in advance</p>