나는 스크롤링 지원이 이미 있습니다 (Pixel by Pixel 스크롤링)되어 있습니다. 이 기능은 가상화가 활성화되어 있지 않은 경우에 유용하지만 사용하도록 설정된 경우 엉망이됩니다. 스크롤의 논리로
는 뷰포트의 높이를 기반으로하고 MSDN에 따라 우리는했습니다 -통합 스크롤링 - "픽셀 별 픽셀"+ "항목 별 아이템"
MSDN- CanContentScroll이 true이면 ExtentHeight, ScrollableHeight, ViewportHeight 및 VerticalOffset 속성의 값은 항목 수 있습니다 . CanContentScroll이 false 인 경우 이러한 속성 값은 Device Independent Pixels입니다. 또한 가상화가 활성화 된 경우 ExtentHeight는 ScrollViewer 및 Viewport Height에있는 Items의 총 개수를 나타냅니다. 현재 표시된 항목 수를 나타냅니다.
그래서 스크롤 힘의 작품은 내가 확인 가상화를 활성화 할 것인지하지만 심지어 힘 작업 난에서 발견 때문입니다
ScrollToContent(ScrollViewer, CurrentMousePositionWRTScrollViewer)
{
if(ScrollViewer's Viewport Height is in terms of Pixel)
{
----------Do Pixel by Pixel Scrolling --------
}
else if(ScrollViewer's Viewport Height represents number of items visible)
{
--------- Do Item by Item Scrolling ---------
}
나는 "CanContentScroll = 거짓"의 체크를 넣어 시도 이렇게 ... 무언가를 원하는 CanContentScroll이 true 인 경우에도 1입니다. 뷰포트 높이 dint는 표시되는 항목의 수를 나타내지 만 실제 높이와 같습니다. 그러나 다른 목록 상자에 표시됩니다 - 항목의 수를 표시합니다. 스크롤의
실제 코드 -
private void ScrollToContent(ScrollViewer scrollViewer, Point point)
{
double verticalScrollOffset = 0.0;
double scrollDifference = 30.0;
double scrollDefaultOffset = 40.0;
if (scrollViewer == null) return;
if (scrollViewer.ViewportHeight != scrollViewer.ExtentHeight)
{
if (scrollViewer.ViewportHeight - point.Y < scrollDifference)
{
// See if we need to scroll down
verticalScrollOffset = scrollDefaultOffset;
}
else if (point.Y < scrollDifference)
{
// See if we need to scroll up
verticalScrollOffset = -scrollDefaultOffset;
}
// Scroll up or down
if (verticalScrollOffset != 0.0)
{
verticalScrollOffset += scrollViewer.VerticalOffset;
if (verticalScrollOffset < 0.0)
{
verticalScrollOffset = 0.0;
}
else if (verticalScrollOffset > scrollViewer.ScrollableHeight)
{
verticalScrollOffset = scrollViewer.ScrollableHeight;
}
scrollViewer.ScrollToVerticalOffset(verticalScrollOffset);
}
}
}
나는 가상화가 범인임을 환상에했지만 IsVirtualization 속성을 확인 후, 나는 가상화 여기 (모두리스트 박스의 진정한) 문제가되지 않습니다 .. 어떤 아이디어를 발견 가능한 경우는 무엇입니까 ??
문제입니다 - 난 내가 뷰포트의 높이를 얻을 한 경우이리스트 박스 (거의 유사한)를했습니다 == 다른 경우 뷰포트의 높이 = 실제 높이에서 그러나 눈에 보이는 항목 수 ..
무엇 가능한 이유가 될 수 있습니까 ??
안녕하세요, 가상화가 켜져 있고 CanContentScroll = True 일 때도 코드가 픽셀 단위로 스크롤됩니까? 그리고이 방법을 어디에서 찾았습니까? SelectedItemChanged 또는 Scrolling? –
레오, 미안하지만이 문제는 오래 전부터 있었으며이 프로젝트에서 더 이상 일하지 않을 것입니다. 기억하지 마세요. – Rohit