0
我有一个ScrollViewer中(NAME =“主”),一个StackPanel里面有一些示例边框或矩形,并且还具有更多的文本,比它的显示的一个文本框,使文本框的滚动。当您滚动文本框,来到顶部奥德底部边框的ScrollViewer中这是在文本框模板(ScrollViewer中X:NAME =“PART_ContentHost”)路由滚动到主的ScrollViewer外(“主”)。TextBlock中的ScrollViewer模板路由滚动?
是否可以编辑文本框模板以减弱此行为?
一种方式是与其他的ScrollViewer的模板组合,这工作得很好,但它#不是更可以看到选择所以这是没有办法了。
您有任何其他想法?
<Style x:Key="TextBoxStyle1" TargetType="{x:Type TextBox}">
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<ScrollViewer x:Name="PART_ContentHost" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ScrollViewer Name="master" Height="71" Width="164" HorizontalAlignment="Right" Margin="0,0,38.666,28.833" VerticalAlignment="Bottom">
<StackPanel Orientation="Vertical" Width="121">
<Rectangle Fill="red" Height="45" Stroke="Black"/>
<Rectangle Fill="red" Height="45" Stroke="Black"/>
<Rectangle Fill="red" Height="45" Stroke="Black"/>
<Rectangle Fill="red" Height="45" Stroke="Black"/>
<TextBox Text="TextBox sydxr gs dgh drz h we rths dretghe dtrzuj hwesrtgh
bdnftzh srdztj ser tghbed5rsetzhnrd hserdfgcjmnjs egrfhfn dshgrdxthgj" TextWrapping="Wrap" Height="67" Style="{StaticResource detail_text}" />
<Rectangle Fill="red" Height="45" Stroke="Black"/>
<Rectangle Fill="red" Height="45" Stroke="Black"/>
</StackPanel>
</ScrollViewer>
非常感谢。