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 6939387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:36:58+00:00 2026-05-27T12:36:58+00:00

I am trying to bind a object collection to a Telerik TreeView control. My

  • 0

I am trying to bind a object collection to a Telerik TreeView control. My object structure would somehow look like:

Item 1.1
   - Item 1.1.1
       - Item 1.2.1
       - Item 1.2.2
   - Item 1.1.2
...
Item n.1
   - Item n.1.1
      - Item n.2.1
        - Item n.3.1

All these object have a common bool property, i.e. isBindable. I want to bind this collection to my TreeView control, but the control should only bind the object if its property isBindable = true.

I don’t want to loop through the whole collection and remove one-by-one based on isBindable before doing an ItemSource to the control.

Any better idea how can I achieve that, maybe with LINQ?

Thanks,
Bhaskar

  • 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-05-27T12:36:59+00:00Added an answer on May 27, 2026 at 12:36 pm

    You can try to achieve this using recursion. You would need a single foreach loop though. Please see the below method. Just pass your collection to this method and see if it gets filtered.

    private List<Item> Filter(List<Item> itemList)
            {
    
                List<Item> filteredItems = (from c in itemList
                                            where c.IsBindable == true
                                            select c).ToList();
                foreach (Item item in filteredItems)
                {
                    if (item.Item != null)
                        item.Item = Filter(item.Item);
                }
    
                return filteredItems;
            }
    
    class Item
        {
            public List<Item> Item { get; set; }
            public bool IsBindable { get; set; }
    
            public Item()
            {
                IsBindable = false;
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a TreeView to bind my collection so that all
I am trying to bind a collection to wpf TreeView control using data templates.
I'm completely new to databinding in WPF, and I'm trying to bind an object
Im trying to bind a list with datetime objects to my repeater. if (e.Item.ItemType
I'm trying to bind a list of custom objects to a WPF Image like
I'm trying to bind a list of integers into an SQLTemplate IN clause like
I'm trying to bind an ObservableCollection to a treeview in WPF. It does kind-of
I'm trying to bind a collection to a ListBox using only XAML. It kind
I am trying to display a single item (not contained in a collection) using
I am currently trying to bind a collection of objects to a Canvas in

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.