How can i get caret index from TextBoxBase?I am creating listener for editor,but i dont have any information about this editor,i can get only TextBoxBase. [EDIT] I use WPF
If this is a Windows Forms TextBoxBase
, you can use SelectionStart
.
If you're dealing with WPF or Silverlight, there is unfortunately no direct way to handle this from the base class, as the selection information is handled by the derived classes, as different classes handle it very differently.
For example, TextBox.SelectionStart
would give you the appropriate point for a TextBox
, but if you had a RichTextBox
, you'd need to look at the Selection
. Start
property explicitly, as it's handled in a separate class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.