Simple text is displayed within CellTemplate section by means of xp:TextBlock statement:
<ColStyle Name="Title" Width="300" Height="0" SortName="Title">
<CellTemplate>
<xp:TextBlock
Text="{Binding Path=[folderObject.title]}">
</CellTemplate>
</ColStyle>
The Name attribute contains the name of the column as it appears in the header, default Width and Height, and SortName (the sort has to be defined in the base query SortList section as directory style SortList section is not currently used.
The content is displayed in xp:TextBlock by means of Binding Path that points to the appropriate content attribute, in the above example, Title.
You may want to add VerticalAlignment and HorizontalAlignment attributes: <ColStyle Name="Title" Width="300" Height="0" SortName="Title"> <CellTemplate> <xp:TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="{Binding Path=[folderObject.title]}"> </CellTemplate> </ColStyle> You may want to add Margin and TextTrimming attributes: <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]}"> </CellTemplate> </ColStyle> The final look may be: <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> </ColStyle> |
Below displays the last modified date in the TextBlock: <ColStyle Name="Modified" Width="150" Height="0" SortName="Modified"> <CellTemplate> <xp:TextBlock VerticalAlignment="Top" Text="{Binding Path=[folderObject.modifiedDate]}" /> </CellTemplate> </ColStyle> |
Below code displays the name of the last editor, and the tooltip displays more data about the editor, using directory style named User. <ColStyle Name="Modifier" Width="150" Height="0" SortName="Modifier"> <CellTemplate> <l:InfoPopup InfoId="{Binding Path=[folderObject.modifierRef]}" DirectoryStyleName="User"> <xp:TextBlock VerticalAlignment="Top" Text="{Binding Path=[folderObject.modifierRef.name]}" /> </l:InfoPopup> </CellTemplate> </ColStyle> |