GridView default ToolTIp

2 posts, 0 answers
  1. Sergey
    Sergey avatar
    4 posts
    Member since:
    Feb 2013

    Posted 12 Feb 2013 Link to this post

    How to remove the tooltip in the grid below. Tooltip that appears when you point to mouseover in the grid. See Image.

    I also turned off all tooltips in the style of the grid at the grid cell. Here is some code

    Disabling in grid

    <telerik:RadGridView x:Name="grdRreList" Grid.Row="1" ItemsSource="{Binding Path=CurrentClient.ResponsibleReportingEntityList, Mode=TwoWay, NotifyOnValidationError=False, ValidatesOnExceptions=False}"
                                         AutoGenerateColumns="False" 


    Disabling in GridCell

    <telerik:GridViewDataColumn  ValidatesOnDataErrors="None" CellStyle="{StaticResource GridViewCellStyle}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}" 
                                                        DataMemberBinding="{Binding Path=SignedProofDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=False,  ValidatesOnExceptions=False}"  
                                                        DataFormatString="d" Header="SIGNED PROOF DATE" MinWidth="160" >


    and disabling in styles

    <ControlTemplate x:Key="GridViewCellTemplate" TargetType="telerikGridView:GridViewCell">
            <Grid>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="SelectionStates">
                        <VisualState x:Name="Unselected"/>
                        <VisualState x:Name="Selected" />
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal"/>
                        <VisualState x:Name="Current" />
                        <VisualState x:Name="MouseOver" />
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="EditingStates">
                        <VisualState x:Name="Edited"/>
                        <VisualState x:Name="Display"/>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="DisabledStates">
                        <VisualState x:Name="Enabled"/>
                        <VisualState x:Name="Disabled">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_CellBorder">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.4"/>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_ContentPresenter">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.7"/>
                                </DoubleAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Background_Disabled">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="ValueStates">
                        <VisualState x:Name="CellValid"/>
                        <VisualState x:Name="CellInvalid">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Background_Invalid">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="InvalidUnfocused">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Background_Invalid_Unfocused">
                                    <DiscreteObjectKeyFrame KeyTime="0">
                                        <DiscreteObjectKeyFrame.Value>
                                            <Visibility>Visible</Visibility>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Border x:Name="PART_CellBorder" BorderBrush="{TemplateBinding VerticalGridLinesBrush}" BorderThickness="0,0,2,0" Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"/>
                <Border BorderThickness="0,0,0,1" BorderBrush="#FFd7d7d7" Margin="0,0,2,0"></Border>
                <Border x:Name="Background_Over" Grid.ColumnSpan="2" Grid.Column="2" Visibility="Collapsed"/>
                <Border x:Name="Background_Selected" Grid.ColumnSpan="2" Grid.Column="2" Visibility="Collapsed"/>
                <Border x:Name="Background_Current" Grid.ColumnSpan="2" Grid.Column="2" Visibility="Collapsed"/>
                <Border x:Name="Background_Invalid" Grid.ColumnSpan="2" Grid.Column="2" Visibility="Collapsed">
                    <!--<ToolTipService.ToolTip>
                        <ToolTip x:Name="validationTooltip" Content="{TemplateBinding Errors}" Placement="Right" Template="{StaticResource GridView_ValidationToolTipTemplate}"/>
                    </ToolTipService.ToolTip>-->
                </Border>
                <Border x:Name="Background_Invalid_Unfocused" Grid.ColumnSpan="2" Grid.Column="2" Opacity="1" Visibility="Collapsed"/>            
                <Border x:Name="Background_Disabled" Grid.ColumnSpan="2" Grid.Column="2" Visibility="Collapsed"/>
                <ContentPresenter x:Name="PART_ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
            </Grid>
        </ControlTemplate>


    Include Custom tooltip


    ControlTemplate x:Key="RadValidationTooltipTemplate" TargetType="Telerik_Windows_Controls_Chromes:ValidationTooltip">
            <Grid x:Name="VisualRoot" ToolTipService.PlacementTarget="{TemplateBinding TooltipPlacementTarget}">
                <ToolTipService.ToolTip>
                    <ToolTip x:Name="PART_ToolTip" Placement="Right" PlacementTarget="{TemplateBinding TooltipPlacementTarget}" Template="{StaticResource ErrorTooltipTemplate}">
                        <ToolTip.Triggers>
                            <EventTrigger RoutedEvent="Canvas.Loaded">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" Storyboard.TargetName="PART_ToolTip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>true</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </ToolTip.Triggers>
                        <Grid>
                            <Border Background="#FFff743e" BorderThickness="0 1 1 1" BorderBrush="#FFed7500"/>
                            <ContentPresenter ContentTemplate="{TemplateBinding TooltipContentTemplate}" Content="{TemplateBinding TooltipContent}"/>
                        </Grid>
                    </ToolTip>
                </ToolTipService.ToolTip>
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" IsHitTestVisible="False">
                    <ContentControl Template="{StaticResource InnerShadowValidationTemplate}"></ContentControl>
                </Border>
            </Grid>
        </ControlTemplate>


    <ControlTemplate x:Key="ValidationToolTipTemplate">
            <Grid x:Name="Root" Margin="2 0 2 0" Opacity="0" RenderTransformOrigin="0,0">
                <Grid.RenderTransform>
                    <TranslateTransform x:Name="xform" X="-25"/>
                </Grid.RenderTransform>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="OpenStates">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0"/>
                            <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
                                <Storyboard>
                                    <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                        <DoubleAnimation.EasingFunction>
                                            <BackEase Amplitude=".3" EasingMode="EaseOut"/>
                                        </DoubleAnimation.EasingFunction>
                                    </DoubleAnimation>
                                    <DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
                                </Storyboard>
                            </VisualTransition>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="Closed">
                            <Storyboard>
                                <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Open">
                            <Storyboard>
                                <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform"/>
                                <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>

                
                <Border Background="#FFff743e" BorderThickness="0 1 1 1" BorderBrush="#FFed7500"/>
                <TextBlock Foreground="White" FontSize="12" FontFamily="../Assets/Fonts/droidsans.ttf#Droid Sans"  MaxWidth="250" Margin="7 5" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false"/>
            </Grid>
        </ControlTemplate>

    and include custom tooltip in styles controls

    <Style TargetType="telerik:RadDatePicker">
            <Setter Property="MinHeight" Value="24"/>
            <Setter Property="Height" Value="24"/>
            <Setter Property="BorderBrush" Value="#FFbdbdbd"/>
            <Setter Property="Foreground" Value="#FF292929" />
            <Setter Property="FontFamily" Value="Arial" />
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Template">

    ...

    <Telerik_Windows_Controls_Chromes:ValidationTooltip x:Name="ValidationTooltip" Grid.ColumnSpan="2" TooltipPlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" TooltipContent="{Binding (Validation.Errors), RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed" />
                            
                            <!--<telerik:Popup IsOpen="{Binding IsTooltipOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Owner="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Top" PlacementTarget="{Binding ElementName=PART_DateTimeInput}">
                                <ContentPresenter ContentTemplate="{TemplateBinding TooltipTemplate}" Content="{TemplateBinding TooltipContent}"/>
                            </telerik:Popup>-->
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    Sorry for my english
  2. Yoan
    Admin
    Yoan avatar
    1214 posts

    Posted 14 Feb 2013 Link to this post

    Hi Sergey,

    The validation ToolTip you are referring to is the default one of the TextBox ( TextBox is the editing element of GridViewDataColumn). 
    In order to remove it, you can try to handle the CellValidated event and set Handled property to "True". Please check the following code snippet for a reference:

    private void MyGridView_CellValidated(object sender, GridViewCellValidatedEventArgs e)
           {
               e.Handled = true;
           }

    I hope this helps.

    Kind regards,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top