MVVM- How can I bind to a textbox's SelectionS

2019-08-05 07:17发布

问题:

What would be the best way to do this?

回答1:

The following - "How to bind SelectionStart Property of Text Box?", asks a similar question and correctly indicates that SelectionStart cannot be bound to is it is not a dependency property (and this is true for SelectionLength as well). Further down a couple of work-arounds have been provided; one using custom textbox (this would be my preference), and another using attached behaviours.