tags:

views:

1089

answers:

1

Hi,

I thought this may be straightforward question but did not find any definitive answer while searching net or SO.

I have created scrollbar style (using standard scroll bard template - Blend 2)

I am not sure how to apply this style "MyScrollStyle" to a ListBox Template .

I saw on ListBox template they have Scroll Viewer --> which should contain the scrollbar

Assuming it is something simple as

---Content Added---

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 -http://blog.xamltemplates.net/wp-content/uploads/2008/12/scrollviewer.zip, to my list view template but it gives error --

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"

Any help is appreciated

Thank you, The Mar

A: 

You need modify ListBox.Template, find ScrollViwer inside and apply style, or disable scroll on ListBox and put it in ScrollViwer with you style.

gimalay
Thank you Gimlay. If I put Listbox inside scrolviewer will I be able to do UI Virtualization for the LisBoxItems
TheMar
No, it will not work. But in most cases this is not necessary. If you need virtualization edit ListBox Template.
gimalay