You might want to consider using a PopUp for this.
XAML:
<TextBox x:Name="txtPassword" Height="30" Width="100" TextChanged="txtPassword_TextChanged" ></TextBox>
<Popup x:Name="txtPasswordPopup" Placement="Top" PlacementTarget="{Binding ElementName=txtPassword}" IsOpen="False">
<TextBlock x:Name="PopupTextBlock" Background="Wheat">CAPSLOCK IS ON!</TextBlock>
</Popup>
Code-Behind:
private void txtPassword_TextChanged(object sender, TextChangedEventArgs e)
{
Boolean Capslock = Console.CapsLock;
if (Capslock == true)
{
PopupTextBlock.Text = "Caps Lock is On.";
txtPasswordPopup.IsOpen = true;
}
else
{
txtPasswordPopup.IsOpen = false;
}
}