Question

I created a class based on UIElement and my intention is to render it myself overriding OnRender. Rendering works fine. Next I want to implement focus management and continue with other aspects of LIFE, but overriding GotFocus and calling Me.Focus() in it don't do a single thing. I places my control on a Window with one another control - TextBox, and clicking on it doesn't do a single think. Tab doesn't set focus too, and TextBox is AcceptsTab negative. I know I will have to visualize focus somehow in OnRender to actually tell when the control is focused or not, but first I need to allow it to receive focus and that's where I struggle. Could you please help me out?

P.S. I tagged this with FrameworkElement because I don't have enough reputation to create a tag UIElement and leaving tags empty seemed like a silly thing to do.

Was it helpful?

Solution

Converting my comment into an answer:

I think you'd probably be better off deriving from FrameworkElement instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top