Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Adding to Tree View

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Adding to Tree View
Link Posted: 16-Jan-2007 05:07
It doesn't seem to be posible to add items manually (so much for \"drop in replacement\"), so I am trying to hook it into a class with the ILISTSOUCE interface. Not having much luck.

Basically, I need to add and remove items from the list view, either as top nodes or sub nodes. It only needs to go one level deep. So far I have just attempted to get anything into it.

In designer I created the bindinge source and added it under Rows>>DataSource. The following code produces \"UITest3.Form1+Word\" in every field:




    ref class stopListSource: IListSource
    {

      public:

      property bool ContainsListCollection
      {
        virtual bool get() = IListSource::ContainsListCollection::get
        {
          return true;
        }
      }

      
      virtual IList^ GetList() = IListSource::GetList
      {
        
        bndStopList->Add(gcnew Word(\"Will\",4,9));
        bndStopList->Add(gcnew Word(\"this\",4,9));
        bndStopList->Add(gcnew Word(\"work?\",4,9));

        return bndStopList;

      }

    };


    ref class Word
    {
    public:
      Word(){}
      Word(String^ word, int level, int frequency)
      {
        word = _word;
        level = _level;
        frequency = _frequency;
      }

      


      property String^ _Word
      {
        String^ get()
        {
          return _word;
        }
        void set(String^ str)
        {
          _word = str;
        }
      }


      property int Level
      {
        int get()
        {
          return _level;
        }
        void set(int lvl)
        {
          _level = lvl;
        }
      }


      property int Frequency
      {
        int get()
        {
          return _frequency;
        }
        void set(int fr)
        {
          _frequency = fr;
        }
      }

      

    private:
      String^ _word;
      int _level;
      int _frequency;
    };

    static BindingList ^bndStopList = gcnew BindingList();
    


If anyone can show me how to do this properly, I would apprectiate it.

I am evaluating the trial version.
Link Posted: 17-Jan-2007 00:18
You should add IList interface implementation also.
Also
- you should add at least one column.
- please check the FieldName property of the column to correctly display cells.