Hi
My class A implements interface IB. For my grid I would like to auto-generate fields for IB only (instead of using other public properties from A). Is this possible?
Thanks!
Yes, you can apply the [Browsable(false)] attribute on the properties that you want to disable or handle the FieldLayoutInitialized event and change the visibility of the Fields.
public class Employee : IEmployee
{
private string firstName;
private string lastName;
public string FirstName
get
return firstName;
}
set
firstName = value;
[Browsable(false)]
public string LastName
return lastName;
lastName = value;
interface IEmployee
string FirstName
get;
set;
string LastName
I can't do that in my case. The problem is that I have an base class which I can't change:
// can't change anything in this class!! public class Person { public string FirstName { get; set; } } public class Employee : Person, IEmployee { public string LastName { get; set; } } public interface IEmployee { string LastName { get; set; } }
Do I have to use the FieldLayoutInitialized? I thought it might be possible to bind to a property of type IEmployee...
If I override properties from my base class, I have to adjust it every time my base class changes (what's not in my hand...).
Therefore it seems like I have to use FieldLayoutInitialized...
You can override the FirstName property from the base class in the Employee class and set the same attribute. Similarly, you can use the FieldLayoutInitialized event to hide the field that is generated for that property.