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

How to get the Image Click Event

1 Answer 115 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Nikhil
Top achievements
Rank 1
Nikhil asked on 18 Sep 2009, 07:09 PM
Hi,

I have modify the TreeviewItem template, where I have one image ( i icon - More Info) along with text

I want to have the Clicked or Mouse Hover event of that Image(that should be separate from the Item selected/clicked event), I want to show popup on that.
if you can help me with the code snippet it will great help.

Regards,
Nikhil

1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 23 Sep 2009, 08:41 AM
Hi Nikhil,

The first thing that comes to my mind is to assign a Tooltip to the image. This way when the user hovers over the image, the tooltip will appear.

You can put whatever you want in the Tooltip, even bind it to a property in your ViewModel and assign a custom template for it.

Here are different ways in which you can bind a tooltip:

<!--Simple Tooltip--> 
<Image Source="My/Image/Source" ToolTipService.ToolTip="Simple Tooltip" /> 
 
<!--Simple Bound Tooltip--> 
<Image Source="My/Image/Source" ToolTipService.ToolTip="{Binding MyTooltipProperty}" /> 
 
<!--Custom Tooltip--> 
<Image Source="My/Image/Source">  
    <ToolTipService.ToolTip> 
        <ToolTip> 
            <Border> 
                <TextBlock Text="Custom Tooltip" /> 
            </Border> 
        </ToolTip> 
    </ToolTipService.ToolTip> 
</Image> 
 
<!--Custom Bound Tooltip--> 
<Image Source="My/Image/Source">  
    <ToolTipService.ToolTip> 
        <ToolTip Content="{Binding MyTooltipProperty}">  
            <ToolTip.ContentTemplate> 
                <DataTemplate> 
                    <Border> 
                        <TextBlock Text="{Binding MyTooltipText}" /> 
                    </Border> 
                </DataTemplate> 
            </ToolTip.ContentTemplate> 
        </ToolTip> 
    </ToolTipService.ToolTip> 
</Image> 

Alternatively, you can put something like a ContextMenu that will behave more like a DropDown menu.

Do you think the Tooltip will work for you?
 
Best wishes,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TreeView
Asked by
Nikhil
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or