I have a usercontrol (U1) inside this i have a canvas - which may have multiple canvas based on number of images and diagrams.
In user another control i have a tool bar which has options like rectangle, line and circle.
When U1 losts its focus i am callinga method to execute which will deselect options in toolbar. [expectation]
But when i click on canvas which is inside the user control U1, the focus lost method is called. and toolbar option is deselected.
MyCode is
In Constructor:
this.LostFocus += new RoutedEventHandler(DesignerControl_LostFocus);
--------------------------
void DesignerControl_LostFocus(object sender, RoutedEventArgs e)
{
ResetCursor();
}
public void ResetCursor()
{
this.ToolbarControl.btnRectangle.IsChecked = false;//here tool bar object is kept as a reference from another Usercontrol.
this.ToolbarControl.btnLine.IsChecked = false;
this.ToolbarControl.btnCircle.IsChecked = false;
this.ToolbarControl.btnTextField.IsChecked = false;
Mouse.OverrideCursor = Cursors.Arrow;
}
Please suggest some idea how to make it work perfectly.
My Aim is to change the cursor and deselect the options when mouse is focused on some other items.
Thank you,