Column style (list) with ellipsis and tooltip, and specific cases for linkObject and img

Build 1501 on 14/Nov/2017  This topic last edited on: 6/Sep/2016, at 13:33

This column displays the title, in 300 units width, using "Title" sort, and if the title is longer, the ellipsis is added at the end. The tooltip, if you hover the mouse above the title, always shows full title. There are specific handlers for the link object (the name is displayed instead of title, and the DescName is displayed in the tooltip, and in particular, for img object, where title is displayed, and DescName in the tooltip.

<ColStyle Name="Title" Width="300" Height="0" SortName="Title">

  <CellTemplate>

    <xp:TextBlock TextTrimming="WordEllipsis" Margin="4,0,4,0" VerticalAlignment="Top" HorizontalAlignment="Left"

      Text="{Binding Path=[folderObject.title]}">

      <xp:TextBlock.ToolTip>

         <TextBlock Text="{Binding Path=[folderObject.title]}" MaxWidth="300" TextWrapping="Wrap"/>

      </xp:TextBlock.ToolTip>

    </xp:TextBlock>

  </CellTemplate>

  <CellTemplate ObjectTypeName="linkObject">

    <xp:TextBlock TextTrimming="WordEllipsis" Margin="4,0,4,0" VerticalAlignment="Top" HorizontalAlignment="Left"

      Text="{Binding Path=[linkObject.name]}">

      <xp:TextBlock.ToolTip>

        <TextBlock Text="{Binding Path=[linkObject:DescName]}" MaxWidth="300" TextWrapping="Wrap"/>

      </xp:TextBlock.ToolTip>

    </xp:TextBlock>

  </CellTemplate>

  <CellTemplate ObjectTypeName="img">

    <xp:TextBlock TextTrimming="WordEllipsis" Margin="4,0,4,0" VerticalAlignment="Top" HorizontalAlignment="Left"

      Text="{Binding Path=[img.title]}">

      <xp:TextBlock.ToolTip>

        <TextBlock Text="{Binding Path=[linkObject:DescName]}" MaxWidth="300" TextWrapping="Wrap"/>

      </xp:TextBlock.ToolTip>

    </xp:TextBlock>

  </CellTemplate>

</ColStyle>