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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:11:25+00:00 2026-06-17T10:11:25+00:00

Removing multiple rows from a TreeView in mono GTK# has tripped me up a

  • 0

Removing multiple rows from a TreeView in mono GTK# has tripped me up a little bit lately and the answer wasn’t a quick google search away so I’m posting this question here. It has been extra problematic removing multiple rows when using sorting with the TreeView (TreeModelSort).

  • 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-17T10:11:26+00:00Added an answer on June 17, 2026 at 10:11 am

    The following function can remove multiple selected rows on a plain TreeView that doesn’t implement a fancy TreeModelSort or TreeModelFilter:

    private void RemoveSelectedRows(TreeView treeView, ListStore listStore)
    {
        TreeIter iter;
    
        TreePath[] treePath = treeView.Selection.GetSelectedRows();
    
        for (int i  = treePath.Length; i > 0; i--)
        {
            listStore.GetIter(out iter, treePath[(i - 1)]);
    
            string value = (string)listStore.GetValue(iter, 0);
            Console.WriteLine("Removing: " + value);
    
            listStore.Remove(ref iter);
        }
    }
    

    This next function can remove multiple selected rows on a TreeView that DOES implement a TreeModelSort (similar logic can be applied if your TreeView is using a TreeModelFilter):

    private void RemoveSelectedRows(TreeView treeView, ListStore listStore, TreeModelSort treeModelSort)
    {
        TreeModel model;
        TreeIter iter;
    
        TreePath[] treePath = treeView.Selection.GetSelectedRows(out model);
    
        for (int i  = treePath.Length; i > 0; i--)
        {
            model.GetIter(out iter, treePath[(i - 1)]);
    
            string value = (string)model.GetValue(iter, 0);
            Console.WriteLine("Removing: " + value);
    
            TreeIter childIter = treeModelSort.ConvertIterToChildIter(iter);
            listStore.Remove(ref childIter);
        }
    }
    

    If anyone has a better way of doing this or sees any bugs in my solution please post a fix, thanks!

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

Sidebar

Related Questions

Which way is the best for removing duplicates from a dataTable for multiple columns?I
How to SELECT multiple tables and JOIN multiple rows from the same column? It
I'm having performance problems when inserting many rows into a GTK treeview (using PyGTK)
Possible Duplicate: Removing multiple classes (jQuery) how can we remove multiple classes from one
Is this an acceptable approach for removing multiple character types from a string or
I'm new to DOM and I'm having trouble removing multiple images that I loaded
Removing annotations from my map view in the following way: if ([[self.mapView annotations] count]
After removing hash from URL using window.location.hash='' page getting reloaded in firefox. EDIT Example:
I am having problems removing index.php from codeigniter-2. I remember using the same code
In IE8 when dynamically removing TR elements from a table inside a DIV with

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.