your code to hide the buttons are placed in the LostFocus event handler of the Farmer button. This will only work if the Focus is currently on the Farmer button and you click elsewhere.
Try placing the code in the MouseClick event of the Form.
Probably would look something like this:
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
this.Details.Visibility = Visibility.Hidden;
this.Orders.Visibility = Visibility.Hidden;
}