Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Ultragrid binding interface or class creates different columns
posted

Hi,

I have an Ultragrid bound to a class DataClass implementing an interface IDataClass, derived from another interface IDataBaseClass.

No columns are then generated for the poperties of the base interface IDataBaseClass

public interface IDataBaseClass
{
int Id { get; }
}

public interface IDataClass : IDataBaseClass
{
int IntDataItel { get; }
string StringDataItem { get; }
}

public class DataClass : IDataClass
{
public int Id { get; set; }
public int IntDataItel { get; set; }
public string StringDataItem { get; set; }
}

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

// this only shows the properties of the interface IDataClassand and NOT of the interface IDataBaseClass
// Thus we have two columns named IntDataItel and StringDataItem
List data1 = new List{
new DataClass{ Id=1, IntDataItel = 11, StringDataItem = "S1"},
};
ultraGrid1.DataSource = data1;

}
}

However, in the following case I do also get the columns for the base class:

public class BaseClass
{
public int Id { get; set; }
}

public class DerivedClass : BaseClass
{
public int IntDataItel { get; set; }
public string StringDataItem { get; set; }
}

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

// this shows both the properties of the class DerivedClass AND BaseClass

// Thus we have two columns named Id, IntDataItel and StringDataItem
List data2 = new List{
new DerivedClass{ Id=1, IntDataItel = 11, StringDataItem = "S1"},
};
ultraGrid1.DataSource = data2;
}
}

I would like to also have columns generated in the case of interface inheritance.

Is this possible?

Attached you'll find a sample project.

We are using the 16.1 version of the controls

Thanks

  • 21795
    Offline posted

    Hello Serge,

    I followed the steps you suggested and was unable to reproduce the behavior you're describing. As for some reason I do not see the sample you attached I created a new one. In my sample I bound UltraGrid to the same classes as you described in your post. When I ran my sample both grids shown same three columns.

    I have attached the sample project I used to test this as well as a small video I recorded during my test. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this issue.

    If the project does not work correctly, this indicates either an issue possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using Infragistics for Windows Forms 2016 volume 1 with latest service release. So could you please let me know the exact version of Infragistics components which you are using?

    If the project does show the product feature working correctly, this indicates a possible issue in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back.

    Please let me know if I can provide any further assistance.

    UltraGridColumns.zip