The problem is that the Infragistics Grid needs a schema.
If it does not receive one, it will show all of the properties of the business object.
I worked around this with two different MM.NET approaches:
Approach One - Manually Define Schema and Use Grid Properties to Hide columns (takes a lot of effort):
1. In the Infragistics Control manually type ALL the fields from the business object (exactly as they appear in the BO) into the UltraWinGridDesigner Basic Settings - Data Schema - Manually Define a Schema section.
2. Change both hidden and header.caption properties as desired in the UltraWinGridDesigner Band and Column Settings - Band 0 (or appropriate Band #) - Columns ColumnName - Hidden property (False to True) and Header.Caption property to read as the column heading needs to be displayed.
Approach Two - Trick the Grid using MM.NET Business Object AND defining a Typed Dataset that is then referenced in your form code so the Grid can import the schema information
1. Review the MM.NET Dev Guide for how to configure your Business Objects to create typed datasets rather than their default behavior and change your BO as required.
2. In the form code, create a reference to this typed dataset
Public Class VisitorTypeForm
Inherits OakLeaf.MM.Main.Windows.Forms.mmBusinessForm
Private oVisitorType As VisitorType
Private dsVisitorType As VisitorTypeDataset
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
Me.oVisitorType = CType(Me.RegisterPrimaryBizObj(New VisitorType), VisitorType)
InitializeComponent()
Me.oVisitorType.GetAllVisitorTypes()
3. Add a dataset to the form by dragging from the toolbox data tab
4. In the dialog Add Dataset - select typed dataset and in the name combobox select Referenced datasets and then select the dataset name from the listing
5. Drop the mmUltraWinGrid on the form
6. For the Data Schema select Manually design the data schema on the fly...
7. On the Edit Schema dialog select the Initialize the Schema from a Data Source option
8. In Data Source combobox select the dataset added to the win form designer
9. Complete the desired other grid properties
10. Make sure the Grid's Binding Source is set in code or in the properties to the MM.NET business object in which you just selected for the schema
11. Change both hidden and header.caption properties as desired in the UltraWinGridDesigner Band and Column Settings - Band 0 (or appropriate Band #) - Columns ColumnName - Hidden property (False to True) and Header.Caption property to read as the column heading needs to be displayed.
I bumped around alot getting this to work... hope this helps!
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group