tags:

views:

319

answers:

2

Hi

I show my business objects in a MS datagrid, containing "country", "city", "street", for example. I can set a tooltip for each column showing its content using a style, so I get the "country" as tooltip when hooverinmg over the "country" column and so on.

But I did not succeed 1) to show the content of "country" when hoovering over "city" 2) to show the content of some other property (not even displayed in the datagrid) when hoovering the datagrid

Any clues? Regards

A: 

Can you paste some of you code here ?? , I want to see how you bind the tool tip for each of the column....

Asim Sajjad
I have standard bindings like this: <dg:DataGridTextColumn Binding="{Binding Path=TrackingNo}" Header="TrackingNo" IsReadOnly="True" /> <dg:DataGridTextColumn Binding="{Binding Path=IntegDate, StringFormat=dd.MM.yyyy HH:mm:ss}" Header="Datum Integration" IsReadOnly="True" />The datagrid itself gets the data like so:gdPatches.ItemsSource = TrackingData.GetTrackingHeaders (which returns an observablecollection of business objects)
klawusel
And here is the Style portion for setting the tooltip: <Style x:Key="CellStyle" TargetType="{x:Type dg:DataGridCell}"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.Text}" />...
klawusel
A: 

Got it

Just define the Cellstyle like so

     <Style BasedOn="{StaticResource CellStyle}" x:Key="ToolTipErrInfo" TargetType="{x:Type dg:DataGridCell}">
        <Setter Property="ToolTip" Value="{Binding /, Path=ErrInfo}" />
     </Style>

CellStyle is the parent Style without Tooltip

klawusel