Hello,
I am using the UltraWinGrid. I specify the data source as an interface. In the form load event I set the datasource to an instance of a class that implements this interface. The cl***ructure looks like this:
public
class BaseClass : IBaseInterface
IDerivedInterface : IBaseInterface
The problem is that the properties defined in IBaseInterface and implemented in BaseClass (that DerivedClass inherits) don't show up in the designer under Band & Col. Settings->Columns.. Thus I can't remove them and they show up in the grid. How does one handle this? I believe I can solve the problem by specifiying the bindingsource as DerivedClass rather than IDerivedInterface but I'd rather not do this as the real project has several class that dervice from IDerivedInterface and could be used.
Suggestions? I have attached the very simple demo project that displays this behaviior.
Thanks.
Hello!
I think the information you gave above is not correct. IDerivedInterface has the information of the properties of IBaseInterface. You can use IBaseInterface properties through IDerivedInterface. I have the same problem with my grid as the original author. It seems that the designer uses only the properties from the interface given, not the inherited properties of the interface.
For example when I define new interface IDerived from two base interface and not adding any properties like this:
public interface IDerived : IBaseInterface1, IBaseInterface2 {}
the designer does not show any properties as IDerived has only the properties of the two bases.
Attached.
This is what I changed:
1. IDerivedInterface is no longer inheriting IBaseInterface.
2. IDerivedInterface has also the properties that IBaseInterface has.
3. DerivedProperty2 has the attribute [Browsable(false)] in the interface, but [Browsable(true)] in the class (not necessary). I don't think it can effect anything other than binding.
4. Column BaseProperty1 is hidden by designer.
You need to change reference to 8.2. I stiil use 8.1.
Amiram,
Can you provide an example? How can you set the column.Header.Hidden to true when the (base) property does not even show up in the designer? Or do you mean it can be done from code? I'm not sure what you mean by setting the attribute [Browsable(false)] for certain properties. Why would I want to limit how others are using the propererties? Surely there is a way to do it with the grid itself.
If you could take my example and fix it up, it would be much appreciated.
Thanks,
Andrew
I think you can add them manually, but it requires more work. If you want that a property won't be shown, you can put the attribute [Browsable(false)] above it, or set the column.Header.Hidden to true.
Thank you for the comments. However, I'm not sure they answer my question. Let me state the question another way:
Given the class/interface structure I mentioned, how does one pick which columns will show up in the grid. I want to have some of the derived interface/cl***properties and some of the base interface/cl***properties, but not all of them.
Perhaps there is a way to add them one by one in the designer? Perhaps there is a simple way to do it without the designer.