は、垂直スクロールが起動するように、私は多くの項目でリストボックスを持っていると言うことができますが、私はWPFのリストボックスのスクロールダウン
ScrollViewer.VerticalScrollBarVisibility="Hidden"
とスクロールバーを非表示になっています私のためにスクロールダウン? iv30は追加しようとしました
Command="ScrollBar.LineDownCommand"
ボタンには効果がありません。
は、垂直スクロールが起動するように、私は多くの項目でリストボックスを持っていると言うことができますが、私はWPFのリストボックスのスクロールダウン
ScrollViewer.VerticalScrollBarVisibility="Hidden"
とスクロールバーを非表示になっています私のためにスクロールダウン? iv30は追加しようとしました
Command="ScrollBar.LineDownCommand"
ボタンには効果がありません。
コマンドハンドラを探す場所をWPFに指示する必要があります。それを伝えることなく、それはButton
から探し始め、LineDownCommand
を扱うものは見つけられません。残念ながらScrollViewer
がの中にあるListBox
がそのテンプレートの一部であるため、ListBox
に設定するだけでは十分ではありません。
ListBoxItem
秒の1に設定すると、naffですが、動作します:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListBox x:Name="_listBox" ScrollViewer.VerticalScrollBarVisibility="Hidden">
<ListBoxItem x:Name="_listBoxItem">One</ListBoxItem>
<ListBoxItem>Two</ListBoxItem>
<ListBoxItem>Three</ListBoxItem>
<ListBoxItem>One</ListBoxItem>
<ListBoxItem>Two</ListBoxItem>
<ListBoxItem>Three</ListBoxItem>
<ListBoxItem>One</ListBoxItem>
<ListBoxItem>Two</ListBoxItem>
<ListBoxItem>Three</ListBoxItem>
<ListBoxItem>One</ListBoxItem>
<ListBoxItem>Two</ListBoxItem>
<ListBoxItem>Three</ListBoxItem>
</ListBox>
<Button Grid.Row="1" Command="ScrollBar.LineDownCommand" CommandTarget="{Binding ElementName=_listBoxItem}">Scroll Down</Button>
</Grid>
</Window>
再テンプレートListBox
のどちらかになると、テンプレート内のButton
スティック、またはになり、これを行うには良い方法コードの後ろにCommandTarget
を配線します。
私は手動でScrollViewerのスクロールを制御したいアプリケーションを持っていました。基本的には、ScrollViewerへの参照を取得してから、ScrollToHorizontalOffset()メソッドを使用してスクロールを制御します。以下は、私が使用するプロセスを説明したブログ記事です:
http://www.developingfor.net/wpf/fun-with-the-wpf-scrollviewer.html
http://www.developingfor.net/wpf/more-fun-with-wpf-scrollviewer.html