This is a migrated thread and some comments may be shown as answers.

Change the item template only for one item

1 Answer 57 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 2
Iron
Iron
Pierre asked on 09 May 2011, 09:03 PM
Here my code:
<TelNavigation:RadTreeView VerticalAlignment="Stretch" SelectionMode="Single" AllowDrop="False">
    <TelNavigation:RadTreeViewItem Header="Achats"  IsExpanded="True" DefaultImageSrc="Images/Icones/Module.png">
        <TelNavigation:RadTreeViewItem Name="CommAchats" Header="Commande Achats"  IsExpanded="False" DefaultImageSrc="Images/Icones/Module.png">
            <TelNavigation:RadTreeViewItem.ItemsPanel>
                <ItemsPanelTemplate>
                    <TextBlock Text="HELLO"></TextBlock>
                </ItemsPanelTemplate>
            </TelNavigation:RadTreeViewItem.ItemsPanel>
        </TelNavigation:RadTreeViewItem>
        <TelNavigation:RadTreeViewItem Name="Fournisseurs" Header="Fournisseurs"  IsExpanded="False" DefaultImageSrc="Images/Icones/Module.png" />
    </TelNavigation:RadTreeViewItem>
    <TelNavigation:RadTreeViewItem Header="Ventes"  IsExpanded="False" DefaultImageSrc="Images/Icones/Module.png">
        <TelNavigation:RadTreeViewItem Name="CommClients" Header="Comm Clients"  IsExpanded="False" DefaultImageSrc="Images/Icones/Module.png" />
        <TelNavigation:RadTreeViewItem Name="Clients" Header="Clients"  IsExpanded="False" DefaultImageSrc="Images/Icones/Module.png" />
    </TelNavigation:RadTreeViewItem>
</TelNavigation:RadTreeView>
I just try to change the control in the item CommAchats for a Image-Text-and 2 imagebuton. For now I just test to display "Hello" instead of the "normal" treeview item. No copile error, but runtime always display the old TreeViewItem

Thanks

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 12 May 2011, 01:03 PM
Hi Pierre,

Instead of setting an ItemsPanel, try setting the Header in the following manner:

<TelNavigation:RadTreeViewItem Name="CommAchats" IsExpanded="False">
    <TelNavigation:RadTreeViewItem.Header>
        <StackPanel Orientation="Horizontal">
            <Image Source="/Images/Icones/Module.png"></Image>
            <TextBlock Text="HELLO"></TextBlock>
        </StackPanel>
    </TelNavigation:RadTreeViewItem.Header>
</TelNavigation:RadTreeViewItem>

Let me know how this works for you.

Best wishes,
Kiril Stanoev
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
Tags
TreeView
Asked by
Pierre
Top achievements
Rank 2
Iron
Iron
Answers by
Kiril Stanoev
Telerik team
Share this question
or