locked
How can i use Tooltip for validation purpose...? RRS feed

  • Question

  • Hi

    I have 3 TextBoxes in my web page i need to set the validations for those controls i don't want to use Validation Controls instead of i want to use Tooltip text for validation message. How can i achieve this..?

    Wednesday, December 19, 2012 1:14 PM

Answers

  • Hi Ganu M,

    Do you develope with xbap, is it relative to WPF.

    In WPF, you could implement the validation for your TextBox, and then shwo tooltip by below xaml code:

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

    for more information, you could refer to this link:

    http://www.codeproject.com/Articles/15239/Validation-in-Windows-Presentation-Foundation

    Best regards,


    Sheldon _Xiao
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Sheldon _Xiao Wednesday, January 2, 2013 7:38 AM
    Friday, December 21, 2012 8:52 AM