tags:

views:

204

answers:

0

I try to explain a little more. I have a class whose name is Resource . It keeps childrens for every single node.

class Resource 
{
 public List<Resource> Children {get;set;}
 public ResourceItem Item {get;set;}
  public bool IsCollapsed {get;set;}
}

class ResourceItem 
{
  public string Name {get;set;}
  public string ImagePath {get;set;}
  ....
  ....
}

I have a treeview uses List of Resource as a ItemsResource with hierarchical datatemplate implementation. Some of leafs IsCollapsed property is false, some of these are true. According to this IsCollapsed property, I hava a style trigger which forces to TreeviewItem being Collapsed or expanded. As a result if there is a node whose Iscollapsed property is false and it has got a children whose iscollapsed property is true, the treeviewItem which is binded to this node, seems with expandable arrow, altough its children do not seem.

So I try to reduce proplem to a simpler sample as below;

I have a treeview in my screen and it has got just one item and also it's visibilty is set as Collapsed as showned below.

 <TreeView Margin="10,10,0,13" Name="TreeView1" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="194" Height="200">
            <TreeViewItem Header="Cold Drinks">
                <TreeViewItem Header="Coke" Visibility="Collapsed"></TreeViewItem>
            </TreeViewItem>
        </TreeView>

So, when I run my code, root node these name is Cold Drinks ,shown as expandable node and seems with arrow. How can I provide this node without expand arrow and without deleting this treeviewItem ?