This is a migrated thread and some comments may be shown as answers.

Validation Tooltip remains open

3 Answers 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
peter
Top achievements
Rank 1
peter asked on 06 Sep 2012, 10:43 AM
Hi i have a a validation tooltip on a textbox, the problem is if i do not enter no text into the textbox and go to another page it remains open, the only way to get rid of it is by refreshing the application. Here is my style, i actually copied it from the telerik CRM demo application.

<Style x:Key="TextBoxStyle" TargetType="TextBox">
        <Setter Property="BorderBrush" Value="{StaticResource MainBrush}" />
        <Setter Property="Foreground" Value="{StaticResource BasicBrush}"/>
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Padding" Value="2,1" />
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.3">
                                        <VisualTransition.GeneratedEasingFunction>
                                            <CircleEase EasingMode="EaseOut"/>
                                        </VisualTransition.GeneratedEasingFunction>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"  Storyboard.TargetName="BorderOver" Storyboard.TargetProperty="Opacity" To="1" />
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Border" d:IsOptimized="True"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"  Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0.2" />
                                        <DoubleAnimation Duration="0"  Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity" To="0.3" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetName="Border" Storyboard.TargetProperty="Background" >
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Transparent" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush" >
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Transparent" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.3">
                                        <VisualTransition.GeneratedEasingFunction>
                                            <CircleEase EasingMode="EaseOut"/>
                                        </VisualTransition.GeneratedEasingFunction>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Focused" >
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusedVisual" d:IsOptimized="True"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Border">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="ValidationErrorElement"
                                            Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="validationTooltip"
                                            Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="ValidationErrorElement"
                                            Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="validationTooltip"
                                            Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
  
                        <Border x:Name="Border" Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" Opacity="0.3" />
                        <Border x:Name="BorderOver"
                            BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" Background="#4C000000" BorderBrush="#CCFFFFFF" />
                        <Border x:Name="FocusedVisual" Opacity="0" BorderBrush="{StaticResource AccentBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" Background="#7F000000" />
                        <ScrollViewer
                            Padding="{TemplateBinding Padding}" BorderThickness="0" Background="Transparent"
                            Foreground="{TemplateBinding Foreground}"
                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                            x:Name="ContentElement" Margin="1" Opacity="0.7"/>
  
                        <!--Error Visual Element-->
                        <Border x:Name="ValidationErrorElement" BorderThickness="1" 
                            CornerRadius="2"
                            BorderBrush="{StaticResource ValidationBrush}" Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                    Template="{StaticResource ValidationTemplate}"
                                    Placement="Right"
                                    PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                    DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                        Storyboard.TargetName="validationTooltip"
                                                        Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <System:Boolean>true</System:Boolean>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Width="12" Height="12" HorizontalAlignment="Right"
                                Margin="1,-4,-4,0" VerticalAlignment="Top"
                                Background="Transparent">
                                <Path Margin="1,3,0,0" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"
                                    Fill="{StaticResource ValidationBrush}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="SelectionForeground" Value="{StaticResource MainBrush}"/>
        <Setter Property="SelectionBackground" Value="{StaticResource StrongBrush}"/>
        <Setter Property="CaretBrush">
            <Setter.Value>
                <SolidColorBrush telerik:MetroColors.Color="Accent" />
            </Setter.Value>
        </Setter>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="12"/>
    </Style>
    <Style BasedOn="{StaticResource TextBoxStyle}" TargetType="TextBox" />
 

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 06 Sep 2012, 03:16 PM
Hello,

I have checked the Style you have applied. What is the result if you type a valid value, or when you press the Esc key?

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
peter
Top achievements
Rank 1
answered on 06 Sep 2012, 03:21 PM
Hi Didie,

Thanks for responding, when i enter a valid  value into it, the tooltip disappears. The ESCkey does nothing, the tooltip remains. Thanks
0
Dimitrina
Telerik team
answered on 07 Sep 2012, 09:02 AM
Hi,

 I was able to exit edit mode after I pressed the Escape key two times. Would it be possible for you to isolate the problem in a demo project which we could debug locally. That way we can further investigate it.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
General Discussions
Asked by
peter
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
peter
Top achievements
Rank 1
Share this question
or