This a test message

Wpf - Show ToolTip text field

<TextBox Name="txtInput">
<TextBox.ToolTip>
    <ToolTip Name="TestToolTip">
        This a test message
    </ToolTip>
</TextBox.ToolTip>

private void btnClick_Click_1(object sender, RoutedEventArgs e)
{
    txtInput.Focus();
    ToolTipTest.IsVisible = true;
}

When a button is clicked, a tooltip is displayed on the button, I want to simulate a mouse pointer into a text field, a toolbar that will be shown for the text field

+3
source share
1 answer

First of all, you should use standard validation for something like what you are doing. From your comment above, I can say what you are doing, and you should know that WPF has a really good built-in system in order to do exactly what you want without doing it so strongly (and very many times).

, , , , , , ( IDataErrorInfo).

<Style.Triggers>
    <Trigger Property="Validation.HasError" Value="true">
        <Setter Property="ToolTip">
           <Setter.Value>
                <ToolTip Content="{Binding RelativeSource={RelativeSource Self}, 
                   Path=(Validation.Errors)[0].ErrorContent}" IsOpen="true" />
           </Setter.Value>
        </Setter>
    </Trigger>
</Style.Triggers>

, adorner , . :

http://blogsprajeesh.blogspot.com/2009/03/handling-error-in-wpf-idataerrorinfo.html

.

+5

Source: https://habr.com/ru/post/1714487/


All Articles