Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datatemplate used for datagridtemplatecolumn
I am trying to show different image on mouse over in Image.
On mouse over, the cursor is changing but image is not changing.
XML
<DataTemplate x:Key="MyDataTemplate" DataType="DataRowView">
        <StackPanel Orientation="Horizontal" removed="Transparent">
            <Image Margin="0,0,0,0"   Width="50" Height="50" Source="{Binding Converter={StaticResource SetImgToDG}}" ToolTip="{Binding}" >
                <Image.Resources>
                    <Style TargetType="{x:Type Image}">
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <!-- Hover image -->
                                <Setter Property="Cursor" Value="Hand"/>
                                <Setter Property="Source" Value="C:\Images\Coil3.png"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Image.Resources>
            </Image>
        </StackPanel>
    </DataTemplate>  


Is that binding creates the problem??
How to resolve it??
Posted

1 solution

Your setter looks wrong. You don't provide values that are on the file system, but values that are resources in your app.

http://www.codewrecks.com/blog/index.php/2010/07/23/bind-an-image-to-a-property-in-wpf/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900