Results 1 to 3 of 3

Thread: [RESOLVED] WPF - DataGrid - Tooltip for individual items

  1. #1

    Thread Starter
    Hyperactive Member Krokonoster's Avatar
    Join Date
    Jan 2010
    Location
    Cape Town
    Posts
    448

    Resolved [RESOLVED] WPF - DataGrid - Tooltip for individual items

    FYI: I'm VERY new to WPF, so forgive me asking questions the wrong way....(or posting too much code)

    Got an existing DataGrid in a form (actually a popup)
    Code:
    <DataGrid x:Name="itemsListBox" HeadersVisibility="None"
    					  VerticalGridLinesBrush="Transparent"
    					  HorizontalGridLinesBrush="Transparent"
    					  Grid.Row="6"
    					  MinHeight="45" 
    					  MaxHeight="107.31"
    					  CanUserAddRows="False"
    					  CanUserDeleteRows="False"
    					  CanUserReorderColumns="False"
    					  CanUserResizeColumns="False"
    					  CanUserResizeRows="False"
    					  AutoGenerateColumns="False" 
    					  Margin="8,4,8,4"
    					  ItemsSource="{Binding Items.ItemsDetailsList}" 
    					  Background="Transparent" 
    					  HorizontalScrollBarVisibility="Disabled" 
    					  Style="{DynamicResource PopUpGrid}"
    					  SelectedItem="{Binding SelectedItemDetail, Mode=TwoWay}"
    					  BorderBrush="{x:Null}"
    					  >
    Now I was asked that if the individual items in the list are too long (> 5 words) to "cut it off" with a "..." and display a tooltip when the user hover over the item.

    A push in the right direction?


  2. #2

    Thread Starter
    Hyperactive Member Krokonoster's Avatar
    Join Date
    Jan 2010
    Location
    Cape Town
    Posts
    448

    Re: WPF - DataGrid - Tooltip for individual items

    Seems one uses ToolTipService.ToolTip="{Binding ...

    Now I just got to figure out what that binding should be....


  3. #3
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: [RESOLVED] WPF - DataGrid - Tooltip for individual items

    I've been working on something very similar lately. Just to note, if you only want the ToolTip when the text in the grid cell is cut off... well, it's not quite just that simple

    I've got a custom control derived from TextBlock that exposes an additional DP for whether the Text as displayed is trimmed. I'm using this in a trigger to set the ToolTip only when the text is trimmed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width