我認爲這可能是直接的問題,但在搜索網絡或SO時沒有找到任何確定的答案。WPF:將滾動條樣式應用於列表框模板 - 錯誤對象不能添加到邊界
我創建了一個ScrollBar
風格(使用標準滾動詩人模板 - 混合2)
我不知道如何將這種風格「MyScrollStyle」適用於ListBox
模板。
我看到ListBox
模板他們有一個ScrollViewer
- >它應該包含ScrollBar
。
假設它是作爲簡單的東西:
<Setter Property ="Template" value="{Static Resource MyScrollStyle}"/>
---添加內容---
模板編輯通過大量的XAML的打算後,我有點明白瞭如何應用樣式。我想在這個例子中設置滾動視圖樣式添加 - http://blog.xamltemplates.net/wp-content/uploads/2008/12/scrollviewer.zip,進入我的列表視圖模板,但它提供了以下錯誤:
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"
任何幫助表示讚賞
謝謝 的三月
從模板: \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t的ScrollViewer> –
TheMar
2009-09-11 19:39:26
如果我錯了,請糾正我的錯誤:我必須爲ScrollViewer編輯模板,並在滾動查看器中使用ScrollBar樣式。我應該將ScrollViewer樣式應用於列表框 – TheMar 2009-09-11 19:50:36
直到現在還沒有運氣 – TheMar 2009-09-12 00:19:41