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
990
tooltip for a record
posted

I'm trying to set a tooltip for a row in a XamDataGrid. Can be done?
I want it when the mouse moves over the record tooltips becomes visible. Can somebody help me?

Thanks

Parents
No Data
Reply
  • 2677
    posted

    Hello,

     If you want to see tooltips for each particular cell, you can do this via styles. 

     <Style TargetType="{x:Type igDP:CellValuePresenter}">

    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=Value}"></Setter>

    </Style>

    Basically, all that I did was create a style that targets the CellValuePresenter (The presenter that displays the cell data) and set the tooltip property.  I used a binding to the Value property off of the CellValuePresenter which is the value of the cell itself. 

    Also, I noticed that you mentioned record and not cell.  If you want this tooltip to appear for the whole record, you will have to do something very similar and target the DataRecordCellArea instead.

    <Style TargetType="{x:Type igDP:DataRecordCellArea}">

    Then, you can initialize the setter and give it any value that you want. 

    if you really want to get fancy, you can create your own ToolTip object and bind that to all three values of the record.  In the snippet below, I assigned the ToolTip of the DataRecordCellArea to the ToolTip object right below it.  In there, I used the PlacementTarget property to set the DataContext of the Tooltip and then used simple binding to get the values from the record(PlacementTarget) to place in the TextBlocks.

    <Style TargetType="{x:Type igDP:DataRecordCellArea}">

    <Setter Property="ToolTip" Value="{StaticResource SpecialToolTip}">

     

    </Setter>

    </Style>

     

    <ToolTip x:Key="SpecialToolTip" DataContext="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget}">

    <StackPanel Orientation="Vertical">

    <TextBlock Text="{Binding Path=Record.Cells[0].Value}"></TextBlock>

    <TextBlock Text="{Binding Path=Record.Cells[1].Value}"></TextBlock>

    <TextBlock Text="{Binding Path=Record.Cells[2].Value}"></TextBlock>

    </StackPanel>

    </ToolTip>

    Hope this helps.   

     

Children