WPF RadgridView Cell Tool tip auto open

4 posts, 0 answers
  1. Vignesh
    Vignesh avatar
    3 posts
    Member since:
    Dec 2012

    Posted 06 Jun 2013 Link to this post

    I need radgridview's cell tool tip to be auto opened when e.IsValid is set to false. Currently it opens when mouse hovers over the corner of the cell.

    Any Suggestions.
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 06 Jun 2013 Link to this post

    Hello Vignesh,



    ValidationToolTip of a GridViewCell is custom styled ToolTip. Predefining the template of GridViewCell and modifying this ToolTip using Microsoft Expression Blend should do the trick.




    Regards,
    Vanya Pavlova
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Vignesh
    Vignesh avatar
    3 posts
    Member since:
    Dec 2012

    Posted 06 Jun 2013 Link to this post

    Using Expression blend we modified GridViewEditorPresenter style of a gridviewcell, but the problem is tool tip opens in the top of the screen, we are not able to make it open in the corner of the gridview cell as a default tooltip.
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 06 Jun 2013 Link to this post

    Hi Vignesh,

     

    In fact they are separate, it depends on the validation mode. If you perform the validation in edit mode, you can see the ValidationToolTip of GridViewEditorPresenter. If you perform the validation in view mode, you will see the ValidationToolTip of GridViewCell. As far as I can understand you need to automatically open the tooltip. In both validation modes you should play with the ToolTip in order to show it in the correct position.
    Something like the following (it's an example for the ValidationToolTip of GridViewEditorPresenter):

    <Style TargetType="{x:Type telerik:GridViewEditorPresenter}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type telerik:GridViewEditorPresenter}">
                            <Grid x:Name="root1">
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="ValueStates">
                                        <VisualState x:Name="Valid"/>
                                        <VisualState x:Name="InvalidFocusedState">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                                                    <DiscreteObjectKeyFrame KeyTime="0">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Visible</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                <Popup Placement="Right" PlacementTarget="{Binding ElementName=root1}" IsOpen="True">
                                <Border x:Name="ValidationErrorElement" Background="Red" BorderBrush="Red" BorderThickness="1" CornerRadius="1" Margin="1,1,1,2" Visibility="Collapsed">
                                 <ContentControl Content="{TemplateBinding ErrorMessage}" Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,3,0"  FontSize="10">
                                                        <ContentControl.ContentTemplate>
                                                            <DataTemplate>
                                                                    <ItemsControl ItemsSource="{Binding}">
                                                                        <ItemsControl.ItemsPanel>
                                                                            <ItemsPanelTemplate>
                                                                                <StackPanel Orientation="Horizontal"/>
                                                                            </ItemsPanelTemplate>
                                                                        </ItemsControl.ItemsPanel>
                                                                        <ItemsControl.ItemTemplate>
                                                                            <DataTemplate>
                                                                                <TextBlock  Margin="8,4,8,4" Foreground="White" FontWeight="Bold" TextWrapping="Wrap" Text="{Binding}"/>
                                                                            </DataTemplate>
                                                                        </ItemsControl.ItemTemplate>
                                                                    </ItemsControl>
                                                              
                                                            </DataTemplate>
                                                        </ContentControl.ContentTemplate>
                                                    </ContentControl>
                                </Border>
                                </Popup>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="VerticalAlignment" Value="Stretch"/>
                <Setter Property="HorizontalAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="Padding" Value="1,1,2,2"/>
            </Style>

    Absolutely the same can be applied to GridViewCell's ValidationToolTip template when you perform validation in view mode.
    Hope this helps!


    Regards,
    Vanya Pavlova
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top