4
我嘗試使用以下方法,但似乎無法在數據綁定列表框上工作。以編程方式滾動Silverlight列表框
mylistbox.ScrollIntoView(mylistbox.Items[mylistbox.Items.Count - 1])
我也想抓IScrollProvider沒有成功:
var lbItemAutomation = (ListBoxAutomationPeer)ListBoxAutomationPeer.CreatePeerForElement(mylistbox);
var listBoxScroller = (IScrollProvider)lbItemAutomation.GetPattern(PatternInterface.Scroll); <-- returns null value
感謝, 瑞奇
更新4/1: 之後重,我確認了第一種方法作品。但是,獲得第二種方法會很好,因爲您可以通過此方法按百分比滾動。所以任何幫助將不勝感激。
你是對的,由於某種原因,它沒有在我的第一次嘗試。如果我不知道如何使第二種方法有效,我會接受你的答案。 – 2010-04-02 13:18:12
SL版本可能存在問題。我有SL 4 RC,我可以進入滾動界面。然後添加: listBoxScroller.SetScrollPercent(-1,50); 滾動到列表中間。 – Timores 2010-04-02 13:56:43