UserControl
列挙型のすべての可能な値をaのように表示しRadioButton
て、ListBox
そのうちの1つを選択します。このコントロールがScrollViewer
テキストボックスなどの他のコントロールとともに内部にあり、マウスホイールでスクロールしようとするとScrollViewer
、マウスカーソルがEnumBox上にあるときにフォームがスクロールされません。
UIでは次のようになります。
デモンストレーションでは、RadioButton
背景が黄色で、WrapPanel
背景が緑色です。マウスカーソルが色付きの領域内(たとえば、内WrapPanel
)にある場合、マウスホイールによるスクロールは効果がありません。
EnumBoxのテンプレートは次のようになります。
<UserControl.Template>
<ControlTemplate TargetType="{x:Type clientsWpf:EnumBox}">
<StackPanel>
<GroupBox Header="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type clientsWpf:EnumBox}}}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource AncestorType={x:Type clientsWpf:EnumBox}}}">
<Border x:Name="InvalidBorder" BorderBrush="Red" BorderThickness="0" >
<ListBox x:Name="PART_ListBox" HorizontalAlignment="Left" KeyboardNavigation.DirectionalNavigation="Cycle" Background="Transparent" BorderThickness="0" SelectedValuePath="." SelectedValue="{Binding Path=SelectedValue, RelativeSource={RelativeSource AncestorType={x:Type clientsWpf:EnumBox}}}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" Background="Green"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Resources>
<Style x:Key="{x:Type ListBoxItem}" TargetType="{x:Type ListBoxItem}" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="Transparent" Background="Yellow">
<RadioButton Margin="3" Focusable="False" Content="{TemplateBinding ContentControl.Content,Converter={StaticResource enumValueDescriptionConverter}}"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}},Path=IsSelected}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Resources>
</ListBox>
</Border>
</GroupBox>
</StackPanel>
</ControlTemplate>
</UserControl.Template>
、、、を設定ScrollViewer.VerticalScrollBarVisibility="Disabled"
してみScrollViewer.CanContentScroll="False"
ましたがListBox
、効果はありませんでした。WrapPanel
RadioButton
Border
4つのコントロールすべてでイベントをキャッチしようとしましScrollBar.Scroll="WrapPanel_Scroll"
たが、いずれもヒットしませんでした。
効果なしで設定SelectiveScrollingGrid.SelectiveScrollingOrientation="None"
してみました。RadioButton
UIでのスクロールを妨げるものについて誰かが手がかりを持っていますか?
明確にするために:それはEnumBox内でスクロールすることではなく、フォーム全体をスクロールすることです。