As I can see, you are using WPF (no tags, but namespaces belong to WPF), so you may do that in XAML:
<Grid>
<TextBox x:Name="SearchTB" />
<TextBlock x:Name="SearchBlock" Text="Search" IsHitTestVisible="False"
VerticalAlignment="Center" />
</Grid>
And in code
if (keyword_length == 0)
{
SearchBlock.Visibility = Visibility.Visible;
myButton.Text = "Cancel";
}
else
{
SearchBlock.Visibility = Visibility.Hidden;
myButton.Text = "Clear";
}
So, you are hiding textblock, which not clickable because of IsHitTestVisible="False"
and visible only when search text is empty.