UserControl on Tooltip when hover a gridcell

5 posts, 1 answers
  1. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 17 Nov 2016 Link to this post

    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

  2. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 21 Nov 2016 in reply to Jacob Link to this post

    Please update me on this as soon as possible. thank you
  3. Martin
    Admin
    Martin avatar
    160 posts

    Posted 22 Nov 2016 Link to this post

    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.
  4. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 29 Nov 2016 Link to this post

    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

     

  5. Answer
    Martin
    Admin
    Martin avatar
    160 posts

    Posted 02 Dec 2016 Link to this post

    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.
Back to Top