Link to home
Start Free TrialLog in
Avatar of thready
thready

asked on

SelectionChanged event in textbox

Hi Experts,

Is there a way to handle the event of SelectionChanged right inside the control (in a derived class?) such as inside the derived class of MyRichTextBox (which derives from RichTextBox)?

Thanks,
Mike
Avatar of isaackhazi
isaackhazi

yes,

Public Event SelectionChanged As RoutedEventHandler
Visual Basic (Usage)
Dim instance As TextBox
Dim handler As RoutedEventHandler

AddHandler instance.SelectionChanged, handler


http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.selectionchanged(VS.95).aspx
from here


Avatar of thready

ASKER

Hi Isaackhazi,

I'm using c# - how would I add the handler with C#?

Thanks,
Mike
public event RoutedEventHandler SelectionChanged
ASKER CERTIFIED SOLUTION
Avatar of isaackhazi
isaackhazi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thready

ASKER

Ahh, I was able to create the event handler in the form and then paste the code into my OnCreateControl within the derived class as needed.  Thanks.