Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 48769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:19:55+00:00 2026-05-10T16:19:55+00:00

The company has the traditional complex organizational structure, defining the amount of levels using

  • 0

The company has the traditional complex organizational structure, defining the amount of levels using the letter ‘n’ rather than an actual number. I will try and express the structure I’m trying to achieve in mono-spaced font:

         Alice  ,--------|-------,------,------, Bob      Fred    Jack   Kim    Lucy  |        |       Charlie  Greg     Darren   Henry Eric 

As you can see it’s not symmetrical, as Jack, Kim and Lucy report to Alice but have no reports of their own.

Using a TreeView with an ItemsPanel containing a StackPanel and Orientation='Horizontal' is easy enough, but this can result in a very large TreeView once some people have 20 others reporting to them! You can also use Triggers to peek into whether a TreeViewItem has children with Property='TreeViewItem.HasItems', but this is not in the same context as the before-mentioned ItemsPanel. Eg: I can tell that Fred has reports, but not whether they have reports of their own.

So, can you conditionally format TreeViewItems to be Vertical if they have no children of their own?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:19:55+00:00Added an answer on May 10, 2026 at 4:19 pm

    I did end up using tips from the linked article, which I’d already read through but didn’t think would help me.

    The meat of it happens here, in a converter:

    <ValueConversion(GetType(ItemsPresenter), GetType(Orientation))> _ Public Class ItemsPanelOrientationConverter Implements IValueConverter  Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, _ ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) _ As Object Implements System.Windows.Data.IValueConverter.Convert      'The 'value' argument should reference an ItemsPresenter.'     Dim itemsPresenter As ItemsPresenter = TryCast(value, ItemsPresenter)     If itemsPresenter Is Nothing Then         Return Binding.DoNothing     End If      'The ItemsPresenter''s templated parent should be a TreeViewItem.'     Dim item As TreeViewItem = TryCast(itemsPresenter.TemplatedParent, TreeViewItem)     If item Is Nothing Then         Return Binding.DoNothing     End If      For Each i As Object In item.Items         Dim element As StaffMember = TryCast(i, StaffMember)         If element.IsManager Then             'If this element has children, then return Horizontal'             Return Orientation.Horizontal         End If     Next      'Must be a stub ItemPresenter'     Return Orientation.Vertical  End Function 

    Which in turn gets consumed in a style I created for the TreeView:

        <Setter Property='ItemsPanel'>         <Setter.Value>             <ItemsPanelTemplate >                 <ItemsPanelTemplate.Resources>                     <local:ItemsPanelOrientationConverter x:Key='conv' />                 </ItemsPanelTemplate.Resources>                 <StackPanel IsItemsHost='True'                              Orientation='{Binding                                RelativeSource={x:Static RelativeSource.TemplatedParent},                              Converter={StaticResource conv}}' />             </ItemsPanelTemplate>         </Setter.Value>     </Setter> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 59k
  • Answers 59k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Try using ScriptManager.RegisterStartupScript, this should provide better support, esp for… May 11, 2026 at 9:00 am
  • added an answer This is covariance, and will be fixed in C# 4.0… May 11, 2026 at 9:00 am
  • added an answer YES! Official support statement: The core Visual Basic 6.0 runtime… May 11, 2026 at 9:00 am

Related Questions

The company has the traditional complex organizational structure, defining the amount of levels using
Let's say that the company has a large number of separate small to medium
I am starting a new job on Monday. The company has a home grown
Recently our company has started measuring the cyclomatic complexity (CC) of the functions in
I am working on an MVC site that is the first my company has
The company I work for has recently been hit with many header injection and
The company I work for has several clients. I'm currently splitting my time between
The company I work for has a large webapp written in C++ as an
The company I work for has historically had very little process as far as
The company I used to work with has two developers working fulltime, and a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.