I have a cellvaluepresenter style specified for a column in my datasource. I would like to show the tooltip for this cell as a different column in the same row. How can I do this? The following line does not work for displaying the model_description as the tooltip for the model_id value.
ToolTip="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igDP:RecordPresenter}}, Path=model_description}"
Field fld = new Field(); fld.Name = "model_id"; fld.Settings.CellValuePresenterStyle = Application.Current.FindResource("leftBorderHyperlinkCell") as Style; fld.Label = "Model ID"; fld.Settings.CellMinWidth = 150.0; fld.Settings.AllowEdit = false; fl.Fields.Add(fld)
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="leftBorderHyperlinkCell"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal"> <Rectangle Margin="3,0,3,0" Width="3" Height="3" Fill="Black" Stroke="Black"/> <TextBlock Foreground="Blue" ToolTip="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igDP:RecordPresenter}}, Path=model_description}" TextDecorations="underline" Cursor="Hand" VerticalAlignment="Center" TextAlignment="Left" HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}"/> </StackPanel> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>
Thanks,
Rod
You can access the data object via the DataItem property, like so:
ToolTip="{Binding Path=DataItem.model_description}"
Josh
Awesome! Thanks Josh.