0
我想知道如何通過點擊某個項目並向上或向下拖動鼠標來上下滾動列表容器,如ItemsControl,而不是使用拖動滾動條使用ScrollViewer?我可以通過拖動行項而不是滾動條來滾動ItemsControl
我搜索了一下,但只找到了使用滾動條上下滾動項目列表的結果。如下
用途:
我想知道如何通過點擊某個項目並向上或向下拖動鼠標來上下滾動列表容器,如ItemsControl,而不是使用拖動滾動條使用ScrollViewer?我可以通過拖動行項而不是滾動條來滾動ItemsControl
我搜索了一下,但只找到了使用滾動條上下滾動項目列表的結果。如下
用途:
您可以使用此附加的行爲,有人寫道
<Window x:Class="WpfApp17.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:WpfApp17"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ScrollViewer local:TouchScrolling.IsEnabled="True">
<ItemsControl>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<system:String>#1</system:String>
<system:String>#2</system:String>
<system:String>#3</system:String>
<system:String>#4</system:String>
<system:String>#5</system:String>
<system:String>#4</system:String>
<system:String>#5</system:String>
<system:String>#6</system:String>
<system:String>#7</system:String>
<system:String>#8</system:String>
<system:String>#9</system:String>
<system:String>#10</system:String>
<system:String>#11</system:String>
<system:String>#12</system:String>
<system:String>#13</system:String>
<system:String>#14</system:String>
<system:String>#15</system:String>
<system:String>#16</system:String>
<system:String>#17</system:String>
<system:String>#18</system:String>
<system:String>#19</system:String>
<system:String>#20</system:String>
</ItemsControl>
</ScrollViewer>
</Grid>
</Window>
感謝我欣賞它! – user1337604