title: WPF: Apply ScrollBar Style to ListBox Template - Error object cannot be added to border
body: <p>I thought this may be straightforward question but did not find any definitive answer while searching net or SO. </p>
  
  <p>I have created a <code>ScrollBar</code> style (using standard scroll bard template - Blend 2) </p>
  
  <p>I am not sure how to apply this style "MyScrollStyle" to a <code>ListBox</code> Template . </p>
  
  <p>I saw on <code>ListBox</code> template they have a <code>ScrollViewer</code> --> which should contain the <code>ScrollBar</code>.</p>
  
  <p>Assuming it is something simple as:</p>
  
  <pre><code>&lt;Setter Property ="Template" value="{Static Resource  MyScrollStyle}"/&gt;
  </code></pre>
  
  <p>---Content Added---</p>
  
  <p>After going through lot of xaml in template edit I kind of understood how to apply style. I am trying to add the  scroll view style set in this example -<a href="http://blog.xamltemplates.net/wp-content/uploads/2008/12/scrollviewer.zip" rel="nofollow noreferrer">http://blog.xamltemplates.net/wp-content/uploads/2008/12/scrollviewer.zip</a>, to my list view template but it gives the following error:</p>
  
  <pre><code>System.Windows.Markup.XamlParseException was unhandled
    Message="'ScrollViewer' object cannot be added to 'Border'. Exception has been thrown by the target of an invocation.  Error at object 'System.Windows.Controls.ScrollViewer' in markup file 'MenuModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;component/resources/Resources.xaml' Line 19 Position 26."
    Source="PresentationFramework"
    LineNumber=19
    LinePosition=26
    NameContext="1_T"
  </code></pre>
  
  <p>Any help is appreciated</p>
  
  <p>Thank you,
  The Mar</p>