float CalculateCancelButtonX(bool focused) { if (focused) { return((Padding.Horizontal() + TextBox.ActualWidth + TextBox.Margin.Horizontal() + CancelButton.Margin.Left()) - CancelButtonActualWidth); } return(ActualWidth + Margin.Horizontal()); }