Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.

I create a control custom control CMTextBox which inherits Textbox. And overrode the method 'OnGotFocus'. But the GotFocus event is not triggered (OnGotFous is not called) when focus is moved to my CMTextBox.Method 'OnLostFocus' also has the same problem.

However, overridden method OnPointerEntered works well.

Is this a bug of OnGotFocus and OnLostFocus?If not, how to raises the GotFocus event and make method 'OnGotFocus' work.

Your ControlTemplate cannot contain another <TextBox>. If you do that, you will end up with 2 TextBoxes, where one TextBox is contained inside the other.

At the moment you cannot specify a different ControlTemplate for the TextBox because the TextBox is rendered as a native html DOM element (more precisely, it is a DIV with the "contenteditable" attribute). There is no way to customize the look of the built-in TextBox other than by setting its built-in properties (Foreground, Background, FontSize, Padding, etc.) OR by wrapping it inside a UserControl and putting stuff around it.

If you remove the ControlTemplate, overriding the OnGotFocus method should work fine. I have just tested it with the following code: