我正在开发一个记事本克隆。我想在textpad中实现一个块选择(垂直选择)。我该怎么做?
编辑: 我不知道应该在这个问题上添加什么样的细节。不过这是我的代码。我需要在此文本框中添加块选择功能。
<TextBox Name="txtContentBox"
Text="{Binding Content, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Stretch"
Background="White"
Foreground="#111111"
BorderThickness="0"
FontSize="{Binding FontSize}"
FontFamily="{Binding CurrentFont}"
FontStyle="{Binding IsItalic, Converter={StaticResource BoolToFontStyle}, ConverterParameter=Italic}"
FontWeight="{Binding IsBold, Converter={StaticResource BoolToFontWeight}, ConverterParameter=Bold}"
TextWrapping="{Binding IsWrap, Converter={StaticResource BoolToWrap}}"
SelectionBrush="#6674AAE2"
AcceptsReturn="True"
AcceptsTab="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
AllowDrop="True"
SnapsToDevicePixels="False"
MouseMove="txtContentBox_MouseMove"
PreviewMouseDown="txtContentBox_PreviewMouseDown"
PreviewMouseUp="txtContentBox_PreviewMouseUp">
<i:Interaction.Triggers>
<i:EventTrigger EventName="TextChanged">
<cmd:EventToCommand Command="{Binding HandleChangesCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="PreviewMouseWheel">
<cmd:EventToCommand Command="{Binding IncDecFontSizeCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
<i:EventTrigger EventName="Drop">
<cmd:EventToCommand Command="{Binding OpenCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
<i:EventTrigger EventName="PreviewDragEnter">
<cmd:EventToCommand Command="{Binding PreviewDraggedFileCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
<i:EventTrigger EventName="PreviewDragOver">
<cmd:EventToCommand Command="{Binding PreviewDraggedFileCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>