AvalonEdit 移除自身ScrollViewer (可配合外部自定义ScrollViewer 使用)

时间:2021-04-08 19:17:13

http://community.sharpdevelop.net/forums/p/11977/42764.aspx#42764

  1:    <Style TargetType="{x:Type AvalonEdit:TextEditor}">
  2:         <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
  3:         <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
  4:         <Setter Property="FlowDirection" Value="LeftToRight"/>
  5:         <!-- AvalonEdit does not support RTL, so ensure we use LTR by default -->
  6:         <Setter Property="Template">
  7:             <Setter.Value>
  8:                 <ControlTemplate TargetType="{x:Type AvalonEdit:TextEditor}">
  9:                     <ContentPresenter Focusable="False"
 10:                         Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TextArea}"
 11:                         >
 12:                     </ContentPresenter>
 13:                 </ControlTemplate>
 14:             </Setter.Value>
 15:         </Setter>
 16:     </Style>