In a Silverlight application I have a custom control with a number of custom properties. In the declaration class of the custom control additionally to defining its properties as dependency properties, I define showing a ToolTip:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
Border bordercntr = base.GetTemplateChild("PART_SBorder") as Border;
bordercntr.MouseEnter += new MouseEventHandler(bordercntr_MouseEnter);
bordercntr.MouseLeave += new MouseEventHandler(bordercntr_MouseLeave);
}
private void bordercntr_MouseEnter(object sender, MouseEventArgs e)
{
string _sno = this.SomeProperty.ToString();
ToolTipService.SetToolTip(this, "Some text " + _sno);
VisualStateManager.GoToState(this, "Hovered",false);
}
The problem is, that a ToolTip pops up not the first time mouse points to a custom control, but only after the second time. After I reload page this happens again: the first time I hover over a control nothing is shown up and then from the second time and further on the ToolTip pops up again. (not always in a stable way, I mean not 100% each time mouse hovers).
What could prevent the ToolTip from showing up in a stable manner each time a mouse hovers over control and starting showing up from the very first time of hovering it after reloading the page?