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

  • Home
  • SEARCH
  • 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 8265727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:54:23+00:00 2026-06-08T04:54:23+00:00

I have been looking into ObjectListView for .NET, and have tried messing with it

  • 0

I have been looking into ObjectListView for .NET, and have tried messing with it myself.

I come from using VirtualTreeview with Delphi, so if you could point out the similarities, that would be great!

I tried creating a multilevel tree using TreeListView and the following class:

public class MyClass
{
    public string Name { get; set; }
    public List<MyClass> MyClasses { get; set; }
    public MyClass(string name)
    {
        Name = name;
        MyClasses = new List<MyClass>();
    }
}

The TreeListView is a design-time component. I use this code to create dummy data and have the TreeListView display it.

var MyClasses = new List<MyClass>();
MyClasses.Add(new MyClass("Bob"));
MyClasses.Add(new MyClass("John"));
var myClass = new MyClass("Mike");
myClass.MyClasses.Add(new MyClass("Joe"));
MyClasses.Add(myClass);

treeListView1.SetObjects(MyClasses);

I also have a single column displaying the Name property.

All this works, except that I am not seeing a child-node for the Mike node. I cant seem to figure out what to do here. I looked at the documentation, but couldn’t find anything helpful.

Also, can a multilevel structure like this be used with the other variants of ObjectListView, such as FastObjectListView?

  • 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. Editorial Team
    Editorial Team
    2026-06-08T04:54:25+00:00Added an answer on June 8, 2026 at 4:54 am

    Finally figured it out!

    Apparently, the only variant of the ObjectListView suite that can be used for a tree structure by design, is the TreeListView!

    Here is how I managed to have my TreeListView display a list of the following class:

    public class MyClass
    {
        public string Name { get; set; }
        public List<MyClass> MyClasses { get; set; }
        public MyClass(string name)
        {
            Name = name;
            MyClasses = new List<MyClass>();
        }
    }
    

    In the Form constructor, we need 2 delegates – one for telling the OLV that an object HAS children, and one for passing the list of children to the OLV.

    // model is the currently queried object, we return true or false according to the amount of children we have in our MyClasses List
    treeListView1.CanExpandGetter = model => ((MyClass)model).
                                                  MyClasses.Count > 0;
    // We return the list of MyClasses that shall be considered Children.
    treeListView1.ChildrenGetter = delegate(object model)
                                           {
                                               return ((MyClass) model).
                                                       MyClasses;
                                           };
    
    // We also need to tell OLV what objects to display as root nodes
    treeListView1.SetObjects(listOfObjects);
    

    I also find it necesary to refresh the parent object whenever I add children to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using .Net 4.0 and SQL Server 2008 R2 I have been looking into utilizing
I have been looking into using Boost.Interprocess to create a disk-backed data structure. The
I have been looking into using tools for UI testing automatically and seem to
I have been looking into different types of timers that i could use for
I have been looking into the namespace for System.Net.PeerToPeer in .NET 4.0 and the
I have been looking into training/using OpenCV to attempt to detect human figures. I
I have been looking into IKVMing Apache's FOP project to use with our .NET
I have been looking into using Facebook Connect for a new web site I
I have been looking into using the Entity Framework in my C# game server
I'm currently redesigning my website and have been looking into using JavaScript and jQuery.

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.