Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Remove / replace the collapser on a TreeViewItem?

 
 
Old 03-05-2006   #1 (permalink)
Chris Sammis


 
 

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.

My System SpecsSystem Spec
Old 03-05-2006   #2 (permalink)
Bai Shi


 
 

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.

My System SpecsSystem Spec
Old 03-06-2006   #3 (permalink)
Chris Sammis


 
 

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?
My System SpecsSystem Spec
Old 03-10-2006   #4 (permalink)
Bai Shi


 
 

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?

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
remove vista and replace with XP Vista General
remove Vista/replace XP? Vista General
Remove oem and replace with another oem Vista General


Vista Forums 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 Ltd

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