public void DataBind () 
		{
			Clear ();

			System.Object o = null;
			o = GetResolvedDataSource (DataSource, DataMember);
			IEnumerable ie = (IEnumerable) o;
			ITypedList tlist = (ITypedList) o;

			// FIXME: does not belong in this base method
			Gtk.TreeIter iter = new Gtk.TreeIter ();
									
			PropertyDescriptorCollection pdc = tlist.GetItemProperties (new PropertyDescriptor[0]);

			// FIXME: does not belong in this base method
			gridColumns = new DataGridColumn[pdc.Count];

			// FIXME: does not belong in base method
			// define the columns in the treeview store
			// based on the schema of the result
			/*
			uint[] theTypes = new uint[pdc.Count];
			for (int col = 0; col < pdc.Count; col++) {
				theTypes[col] = (int) TypeFundamentals.TypeString;
			}
			*/
			GType [] theTypes = new GType[pdc.Count];
			for ( int col=0; col<pdc.Count; col++ ) {
				theTypes[col] = (GType)GType.String;
			}
			store.ColumnTypes = theTypes;

			// FIXME: does not belong in this base method
			int colndx = -1;
			foreach (PropertyDescriptor pd in pdc) {
				colndx ++;
				gridColumns[colndx] = new DataGridColumn ();
				gridColumns[colndx].ColumnName = pd.Name;				
			}

			foreach (System.Object obj in ie) {
				ICustomTypeDescriptor custom = (ICustomTypeDescriptor) obj;
				PropertyDescriptorCollection properties;
				properties = custom.GetProperties ();
				
				iter = NewRow ();
				int cv = 0;
				foreach (PropertyDescriptor property in properties) {
					object oPropValue = property.GetValue (obj);
					string sPropValue = oPropValue.ToString ();
					
					// FIXME: does not belong in this base method
					SetColumnValue (iter, cv, sPropValue);

					cv++;
				}
			}

			// FIXME: does not belong in this base method
			treeView.Model = store;
			AutoCreateTreeViewColumns ( treeView );
		}
Exemple #2
0
        public void DataBind()
        {
            Clear();

            System.Object o = null;
            o = GetResolvedDataSource(DataSource, DataMember);
            IEnumerable ie    = (IEnumerable)o;
            ITypedList  tlist = (ITypedList)o;

            // FIXME: does not belong in this base method
            Gtk.TreeIter iter = new Gtk.TreeIter();

            PropertyDescriptorCollection pdc = tlist.GetItemProperties(new PropertyDescriptor[0]);

            // FIXME: does not belong in this base method
            gridColumns = new DataGridColumn[pdc.Count];

            // FIXME: does not belong in base method
            // define the columns in the treeview store
            // based on the schema of the result

            /*
             * uint[] theTypes = new uint[pdc.Count];
             * for (int col = 0; col < pdc.Count; col++) {
             *      theTypes[col] = (int) TypeFundamentals.TypeString;
             * }
             */
            GType [] theTypes = new GType[pdc.Count];
            for (int col = 0; col < pdc.Count; col++)
            {
                theTypes[col] = (GType)GType.String;
            }
            store.ColumnTypes = theTypes;

            // FIXME: does not belong in this base method
            int colndx = -1;

            foreach (PropertyDescriptor pd in pdc)
            {
                colndx++;
                gridColumns[colndx]            = new DataGridColumn();
                gridColumns[colndx].ColumnName = pd.Name;
            }

            foreach (System.Object obj in ie)
            {
                ICustomTypeDescriptor        custom = (ICustomTypeDescriptor)obj;
                PropertyDescriptorCollection properties;
                properties = custom.GetProperties();

                iter = NewRow();
                int cv = 0;
                foreach (PropertyDescriptor property in properties)
                {
                    object oPropValue = property.GetValue(obj);
                    string sPropValue = oPropValue.ToString();

                    // FIXME: does not belong in this base method
                    SetColumnValue(iter, cv, sPropValue);

                    cv++;
                }
            }

            // FIXME: does not belong in this base method
            treeView.Model = store;
            AutoCreateTreeViewColumns(treeView);
        }