WPF ,listbox,平滑滾動的2種方式。


一,烤地瓜版本的。。  這個版本不安裝內容滾動,,鼠標滑輪滾動一次距離相同,

  具體步驟參照他的博客,說點注意的,,

1,ScrollViewer.CanContentScroll="False"

2,容器模版虛擬化StackPanel換成非虛擬的。

<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
			<StackPanel IsItemsHost="True"/>
		</ItemsPanelTemplate>

  二,安裝內容滾動,,滑輪滾動一次,listbox移動3項,體驗沒有一的好。。。ScrollViewer.CanContentScroll="True"

 <ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
            <VirtualizingStackPanel IsItemsHost="True">
                <i:Interaction.Behaviors>
                    <ei:FluidMoveBehavior AppliesTo="Children"/>
                </i:Interaction.Behaviors>
            </VirtualizingStackPanel>
        </ItemsPanelTemplate>

   很簡單的效果,,,下載Demo


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM