Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF DataGrid Binding
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.
<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 31-Dec-12 22:26pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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/[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 6,725
1 OriginalGriff 6,696
2 CPallini 5,315
3 George Jonsson 3,589
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100