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

UserControl on Tooltip when hover a gridcell

4 Answers 283 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jacob
Top achievements
Rank 1
Jacob asked on 17 Nov 2016, 05:08 PM

Hello Telerik,

We came across a scenario which we need to add a tooltip containing a UserControl to a tooltip of a grid's cell.

Can you please point me to the right direction?

 

Thank you

4 Answers, 1 is accepted

Sort by
0
Jacob
Top achievements
Rank 1
answered on 21 Nov 2016, 04:25 PM
Please update me on this as soon as possible. thank you
0
Martin
Telerik team
answered on 22 Nov 2016, 07:59 AM
Hello Jacob,

To achieve the desired behavior, please take a look at our Add ToolTip for columns and headers article where you can find how to add a control in DataTemplate of the ToolTip. Similarly, may be added a UserControl inside it. Also, you can find more helpful information on the matter in this thread.

I hope that this helps.

Regards,
Martin Vatev
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Jacob
Top achievements
Rank 1
answered on 29 Nov 2016, 10:23 AM

Hi Martin, thank you for your reply

I have followed your tip and got my tooltip showing preloaded data.

but I need to modify this solution in order to show data on demand. that is on mouse hovering of that cell

here is what I came up with:

<telerik:GridViewDataColumn   Width="50*"
                            DataMemberBinding="{Binding UserCount}" IsFilterable="False">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding UserCount}" MouseEnter="TextBlock_MouseEnter" />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
    <telerik:GridViewColumn.ToolTipTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <ListBox ItemsSource="{Binding UserNames}"/>
            </StackPanel>
        </DataTemplate>
    </telerik:GridViewColumn.ToolTipTemplate>
</telerik:GridViewDataColumn>

 

and the mouseenter event will trigger a Load method on the viewmodel to update the UserNames property there (a list of string)

but it won't work. the list comes empty. Is there something we can do about it?

 

Thanks

 

0
Accepted
Martin
Telerik team
answered on 02 Dec 2016, 09:17 AM
Hi Jacob,

For your convenience, I prepared an example to demonstrate how to achieve the desired behavior. Please take a look at the implementation and consider how this approach fits your scenario.

I hope that this helps. Should you have any other questions, do not hesitate to contact us.

Regards,
Martin Vatev
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
Jacob
Top achievements
Rank 1
Answers by
Jacob
Top achievements
Rank 1
Martin
Telerik team
Share this question
or