# .NET and More > WPF, WCF, WF >  [RESOLVED] Mouse Over item in listbox trigger

## chris128

Hi guys,

I am experimenting with listbox customization and although it was going quite smoothly I have now hit a stumbling block that is annoying me like mad.

Basically, all I want to do is make it so that when the mouse passes over an item in the listbox, an animation is triggered. However, I thought I would start out simple and just make it so that instead of kicking off an animation, it just adjusts the opacity level of the item that is being hovered over.

This is proving to be a bit of a nightmare though...
Basically I have a DataTemplate that I am using for the ItemTemplate property of the ListBox, so that I can display some images with borders and reflections in the listbox. So I figured I just needed to add a trigger to that datatemplate and after countless different attempts this is what I ended up 'borrowing' from someone else on the internet, but it still doesnt work! No errors or anything, it just doesnt adjust the opacity of the item that the mouse is over:

xml Code:
<DataTemplate.Triggers>
                <DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource TemplatedParent}}"
                                 Value="True">
                    <Setter Property="Opacity" Value="1" />
                </DataTrigger>
</DataTemplate.Triggers>

Am I going about this the wrong way? I'm totally confused! Any suggestions appreciated.

----------


## chris128

Nevermind, got it working using the following:


xml Code:
<DataTemplate.Triggers>
                <Trigger SourceName="ImageContainer" Property="IsMouseOver" Value="True">
                    <Setter TargetName="ActualImage" Property="Opacity" Value="1" />
                </Trigger>
</DataTemplate.Triggers>

----------

