In This Topic
    In This Topic

    The following example demonstrates how to show a tooltip on a DataRow which displays the value corresponding to the content of a cell of a hidden column.

    XAML
    Copy Code
    <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
      <Grid.Resources>
        <Style TargetType="{x:Type xcdg:DataRow}">
          <EventSetter  Event="MouseEnter"
                        Handler="OnDataRowMouseEnter" />
        </Style>
        <xcdg:DataGridCollectionViewSource x:Key="cvs_orders"
                                           Source="{Binding Source={x:Static Application.Current}, Path=Orders}"/>
      </Grid.Resources>
      <xcdg:DataGridControl x:Name="OrdersGrid"
                            ItemsSource="{Binding Source={StaticResource cvs_orders}}" >
        <xcdg:DataGridControl.Columns>
          <xcdg:Column FieldName="OrderID"
                       Visible="False" />
        </xcdg:DataGridControl.Columns>
      </xcdg:DataGridControl>
    </Grid>

     

    VB.NET
    Copy Code
    Private Sub OnDataRowMouseEnter(ByVal sender As Object, ByVal e As MouseEventArgs)
       Dim dataRow = TryCast(sender, Xceed.Wpf.DataGrid.DataRow)
       If dataRow Is Nothing Then
          Return
       End If
       Dim dataRowView = TryCast(dataRow.DataContext, System.Data.DataRowView)
       If dataRowView Is Nothing Then
          Return
       End If
       dataRow.ToolTip = dataRowView.Row("OrderID").ToString()
    End Sub

     

    C#
    Copy Code
    private void OnDataRowMouseEnter( object sender, MouseEventArgs e )
    {
      var dataRow = sender as Xceed.Wpf.DataGrid.DataRow;
      if( dataRow == null )
        return;
      var dataRowView = dataRow.DataContext as System.Data.DataRowView;
      if( dataRowView == null )
        return;
      dataRow.ToolTip = dataRowView.Row[ "OrderID" ].ToString();
    }