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

WPF RadgridView Cell Tool tip auto open

3 Answers 137 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vignesh
Top achievements
Rank 1
Vignesh asked on 06 Jun 2013, 06:54 AM
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.

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 06 Jun 2013, 07:25 AM
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.

0
Vignesh
Top achievements
Rank 1
answered on 06 Jun 2013, 07:31 AM
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.
0
Vanya Pavlova
Telerik team
answered on 06 Jun 2013, 10:42 AM
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.

Tags
General Discussions
Asked by
Vignesh
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Vignesh
Top achievements
Rank 1
Share this question
or