110,536
社区成员
发帖
与我相关
我的任务
分享
<TextBox x:Name="TraceTextBox" TextWrapping="Wrap" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" MinHeight="200"/>
<Grid.Resources>
<Style x:Key="customScrollBar" TargetType="{x:Type ScrollBar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<StackPanel>
<!--上按钮-->
<RepeatButton HorizontalAlignment="Center" VerticalAlignment="Top" Command="ScrollBar.LineUpCommand" Content="^"/>
<Track x:Name="PART_Track" IsDirectionReversed="True" Height="100">
<Track.DecreaseRepeatButton>
<!--上空白-->
<RepeatButton Command="ScrollBar.PageUpCommand" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<!--滑块-->
<Thumb Background="Black"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<!--下空白-->
<RepeatButton Command="ScrollBar.PageDownCommand" />
</Track.IncreaseRepeatButton>
</Track>
<!--下按钮-->
<RepeatButton HorizontalAlignment="Center" VerticalAlignment="Top" Command="ScrollBar.LineDownCommand" Content="v"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<TextBox
x:Name="TextBox1"
Width="300" Height="200"
Style="{StaticResource customScrollBar}"/>
<Style TargetType="{x:Type ScrollBar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<StackPanel>
<!--上按钮-->
<RepeatButton HorizontalAlignment="Center" VerticalAlignment="Top" Command="ScrollBar.LineUpCommand" Content="^"/>
<Track x:Name="PART_Track" IsDirectionReversed="True" Height="100">
<Track.DecreaseRepeatButton>
<!--上空白-->
<RepeatButton Command="ScrollBar.PageUpCommand" />
</Track.DecreaseRepeatButton>
<Track.Thumb>
<!--滑块-->
<Thumb Background="Black"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<!--下空白-->
<RepeatButton Command="ScrollBar.PageDownCommand" />
</Track.IncreaseRepeatButton>
</Track>
<!--下按钮-->
<RepeatButton HorizontalAlignment="Center" VerticalAlignment="Top" Command="ScrollBar.LineDownCommand" Content="v"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<TextBox
x:Name="mlbox"
AcceptsReturn="True"
AcceptsTab="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
Width="300" Height="200"/>