Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
How do you add a tooltip to a XamGrid's ImageColumn?
posted

Dear community member.

My XamGrid contains an ImageColumn that us used to display a set of icons.  Each of these icons has a corresponding state (i.e. an enum value).  Ideally I would like to:

  • display an image in the column
  • display the enum value as a tool tip on each image's cell

The following code works great except: the tool tip will start displaying an image (instead of the enum value) if you deserialize the XamGrid using the PersistenceManager.

To recap:

  1. load the XamGrid for the first time
    •  everything works as expected (i.e. tool tip is an enum)
  2. serialize the XamGrid and then deserialize the XamGrid
    • the tool tip now displays an image instead of the enum value

SAMPLE CODE

<ig:ImageColumn Key="Severity" ValueConverter="{StaticResource EventSeverityToImageConverter}" AllowToolTips="Always">                    
                <ig:ImageColumn.ToolTipContentTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Severity}"/>
                    </DataTemplate>
                </ig:ImageColumn.ToolTipContentTemplate>
                <ig:ImageColumn.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock Text="Event Severity"/>
                    </DataTemplate>
                </ig:ImageColumn.HeaderTemplate>
            </ig:ImageColumn>

NOTE: EventSeverityToImageConverter converts the given enumeration value into an image (i.e. *.PNG)