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

Strikethroughed text in a TreeViewItem using a ItemTemplate

0 Answers 132 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tobias
Top achievements
Rank 1
Tobias asked on 11 Apr 2013, 10:59 AM
Hi folks,
I have the following problem:
  1. I have a RadTreeViewItemTemplate 
  2. I want to set the text decoration to strikethrough
  3. I want to use a template and not a new control
  4. Please help. :)

I checked several blogs and forum posts, nothing really helped me. 

Thanks a lot!

- Tobias

<telerik:RadTreeView.ItemTemplate>
    <telerik:HierarchicalDataTemplate ItemsSource="{Binding Children}">
        <Grid>
            <TextBlock x:Name="MyText" Text="{Binding Name}"/>
        </Grid>
    </telerik:HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>


UPDATE
I solved the first problem with the following changes:
<Grid>
<TextBlock Text="{Binding Name}"/>
<Rectangle Height="1" VerticalAlignment="Center" Fill="Black" />
</Grid>


So, I need a way how to set diffrent template - because only delete items should be strikeouted.

SOLUTION

Hi,
I found a solution. You need a TreeViewItemTemplateSelector and a HierarchicalDataTemplate incl. Code-Behind files.
It works! Yay.

- Tobias 

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Tobias
Top achievements
Rank 1
Share this question
or