TreeListView - CellTemplate & ItemTemplate (Both appear when I click on a tree element)

2 posts, 0 answers
  1. Rogério Ferreira
    Rogério Ferreira avatar
    9 posts
    Member since:
    Jun 2009

    Posted 26 Mar 2010 Link to this post

    (Opened a support ticket with this information and with a small application to show this behaviour)


     I'm having what I think is a strange behaviour, probably is something I'm doing wrong.

     As I stated in the thread title, when I click on a tree item both cellTemplate and ItemTemplate appear, so If I click on an item two lines appear, the 1st being the CellTemplate representation and the 2nd line the ItemTemplate representation. (attch: double.jpg).

     This is the code that I'm using:

            <admConverter:MulticastTreeItemImageConverter x:Name="treeItemConverter"/> 
            <admConverter:MulticastTreeItemValueConverter x:Name="treeItemValueConverter"/> 
            <DataTemplate x:Key="fieldTemplate"
                <StackPanel Orientation="Horizontal"
                    <Image Source="{Binding Converter={StaticResource treeItemConverter}}" Margin="0,0,6,0" /> 
                    <TextBlock Text="{Binding Name}" Margin="2"/> 
            <DataTemplate x:Key="fieldValueTemplate"
                <StackPanel Orientation="Horizontal"
                    <TextBlock Text="{Binding Converter={StaticResource treeItemValueConverter}}" Margin="2"/> 
            <telerikControls:HierarchicalDataTemplate x:Key="messageTemplate" ItemsSource="{Binding Value.MessageFields}"
                <StackPanel Orientation="Horizontal"
                    <Image Source="/Cmf.Presentation.Framework.Core.Controls;component/Images/Generic/folder-16x16.png" Margin="0,0,6,0" /> 
                    <TextBlock Text="{Binding Name}" Margin="2"/> 
                FieldTemplate="{StaticResource fieldTemplate}"  
                MessageTemplate="{StaticResource messageTemplate}"/> 
        <Grid x:Name="LayoutRoot"
                ItemTemplateSelector="{StaticResource treeTemplateSelector}" 
                    <telerikNavigation:RadColumn CellTemplate="{StaticResource fieldTemplate}"  PropertyName="Name" Header="Name"/> 
                    <telerikNavigation:RadColumn CellTemplate="{StaticResource fieldValueTemplate}" PropertyName="Value" Header="Value"/> 

    I'm using HierarchicalDataTemplate to be able to show a object that has several levels.

    Message X
     - Field A
     - Field B
     - Message Y
        - Field C 
        - Field D

    Thanks ahead for all the help,

    Rogério Ferreira
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 29 Mar 2010 Link to this post

    Hi Rogério Ferreira,

    I answered the support ticket you opened, still I'd like to post the answer here as well.

    The described behavaior is expected, because the ItemTemplate is used as a details template for each row.  Therefore, when the ItemTemplate specifies which properties to be displayed in a certain way,  this properties will appear bellow the selected item as details.

    If you don't want to display details for the rows, you can simply leave the ItemTemplate empty.

    Sincerely yours,
    Tina Stancheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top