This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ListBoxのScrollViewerを取得 | |
var border = VisualTreeHelper.GetChild(listBox, 0) as Border; | |
if (border != null) | |
{ | |
listBoxScroll = border.Child as ScrollViewer; | |
if (listBoxScroll != null) | |
{ | |
// スクロールバー非表示 | |
listBoxScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; | |
// スクロールバーを末尾に移動 | |
listBoxScroll.ScrollToEnd(); | |
} | |
} |
ScrollIntoViewやSelectedIndexを使わずにスクロールさせる方法を探していたので役立ちました。ありがとうございます。
返信削除