Trigger ToolTip on buttonclick

2 posts, 0 answers
  1. Minh
    Minh avatar
    43 posts
    Member since:
    May 2014

    Posted 24 Sep 2014 Link to this post

    I'm trying to have Validation errors for my RadMaskedTextBox, Currently I was able to do that but it's dynamic and I want to change that.If I set the range only < 250, and I put 500 inside the textbox it'll trigger and the Validation Error will appear.What I want to happen is the Validation Error only happen when my button is pressed. May I ask how do I convert to do that?

    <ControlTemplate x:Key="validationTemplate">
            <AdornedElementPlaceholder />
            <TextBlock FontSize="20" Foreground="Red">Error!</TextBlock>

        Validation.ErrorTemplate="{StaticResource validationTemplate }"
        Value="{Binding Path=DecimalValue,
        UpdateSourceTrigger=PropertyChanged}" />

    <Button Content="Execute" cal:Message.Attach="[Click] = [ExecuteMessage]"/>ViewModel:private decimal decimalValue;

    public decimal DecimalValue
        get { return decimalValue; } 
        if (value > 250)
            throw new ValidationException("Value cannot be greater than 250.");
        decimalValue = value;
  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 25 Sep 2014 Link to this post


    I can see the UpdateSourceTrigger property of the binding is set to PropertyChanged. This means that every time you type into the control, the validation logic will be triggered. In order to achieve your requirements you can use some of the other valid values.

    Also, you can take a look at this post and evaluate the approach that is suggested there. It might be effective in your particular case.

    Pavel R. Pavlov
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top