Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Remove / replace the collapser on a TreeViewItem?

Closed Thread
 
Thread Tools Display Modes
Old 03-05-2006   #1 (permalink)
Chris Sammis
Guest


 

Remove / replace the collapser on a TreeViewItem?

Is it possible to remove or replace the collapser button on a TreeViewItem?
Ideally I'd like it gone entirely, but otherwise I would style it. I know
that the presence of a collapser indicates to the user that there is data
"underneath" the node, and usually one wouldn't remove it because it breaks
UI cues to not have it, but in my application's case the user isn't supposed
to see underlying data unless running in an "advanced" mode.

If it isn't possible, can anyone suggest other ways of presenting
hierarchial data? Currently I'm using a ListBox and toggling the visiblity
of "child" items between Visible and Collapsed, but it feels like a giant
hack and isn't proving to be very scalable, performance-wise.
Old 03-05-2006   #2 (permalink)
Bai Shi
Guest


 

RE: Remove / replace the collapser on a TreeViewItem?

I think you can restyle TreeViewItem to achieve this. You can bind
collapser.Visibility with TreeViewItem.HasItems property.
BooleanToVisibilityConverter can convert the Visiblity to boolean.

<Style x:Key="{x:Type TreeViewItem}" TargetType="{x:Type TreeViewItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid>
....
<ToggleButton Visiblity="{Binding HasItems,
Converter=..., RelativeSource=....}"/>
</Grid>
</ControlTemplate TargetType="{x:Type TreeViewItem}">
</Setter.Value>
</Setter>
</Style>

Thanks
Bai Shi

"Chris Sammis" wrote:

> Is it possible to remove or replace the collapser button on a TreeViewItem?
> Ideally I'd like it gone entirely, but otherwise I would style it. I know
> that the presence of a collapser indicates to the user that there is data
> "underneath" the node, and usually one wouldn't remove it because it breaks
> UI cues to not have it, but in my application's case the user isn't supposed
> to see underlying data unless running in an "advanced" mode.
>
> If it isn't possible, can anyone suggest other ways of presenting
> hierarchial data? Currently I'm using a ListBox and toggling the visiblity
> of "child" items between Visible and Collapsed, but it feels like a giant
> hack and isn't proving to be very scalable, performance-wise.

Old 03-06-2006   #3 (permalink)
Chris Sammis
Guest


 

RE: Remove / replace the collapser on a TreeViewItem?

What I have derived from Bai Shi's post is here: http://pastebin.com/586287

However, if you put that in XamlPad you can see the problem: even
explicitly setting IsExpanded to true doesn't show child elements. How can I
accomplish that?
Old 03-10-2006   #4 (permalink)
Bai Shi
Guest


 

RE: Remove / replace the collapser on a TreeViewItem?

Hi Chris, I can't find anything from http://pastebin.com/586287
Can you send me a simple repro of you codes? You can send it to
cabbagebai@ustc.edu.
I think I didn't understand you problem very clearly.

Thanks
Bai Shi

"Chris Sammis" wrote:

> What I have derived from Bai Shi's post is here: http://pastebin.com/586287
>
> However, if you put that in XamlPad you can see the problem: even
> explicitly setting IsExpanded to true doesn't show child elements. How can I
> accomplish that?

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove vista and replace with XP stace1 Vista General 15 02-06-2008 08:20 PM
remove Vista/replace XP? lmo Vista General 16 11-29-2007 07:19 AM
Remove oem and replace with another oem justthefacts Vista General 7 08-24-2007 10:44 AM
TreeView, TreeViewItem knallkopf66 Avalon 1 08-16-2007 08:24 PM
How to get the Parent of a TreeViewItem in a treeview when using HierchicalDataTemplate ? Pon Avalon 1 04-05-2007 03:16 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50