DataGridView does not use TypeConverter PropertyGrid uses TypeConverter.
DataGridView does not use TypeConverter; PropertyGrid uses TypeConverter. If it relates to list-controls like DataGridView, then the other answer is wrong. To provide custom properties on a list, you need one of: ITypedList on the data-source TypeDescriptionProvider on the type Both are non-trivial.
Thank you. It's not possible to apply TypeDescriptionProvider to an interface, but implementing ITypedList in my data source works perfectly at run-time. Seeing my custom properties at design-time would be nice, but I think I can find a workaround that will be sufficient.
– spatulon Jun 26 '09 at 12:24.
My Suggestion would be to create a Interface that "reimplements" the propertys you want: Let's say you have two interfaces: public interface IHasName1 { String Name1 { get; set; } } public interface IHasName2 : IHasName1 { String Name2 { get; set; } } And a class that implements IHasName2: public class HasTwoNames : IHasName2 { #region IHasName1 Member public string Name1 { get; set; } #endregion #region IHasName2 Member public string Name2 {get; set; } #endregion } Now, thx for figuring that out btw. , if you have a List with objects of concrete type HasTwoNames and you bind that list to a dgv, it only displays the member (Name2) of IHasName2. A "workaround" is to create a new interface "IHasEverything" that inherits from IHasName2 and therefore from IHasName1 and reimplements the Propertys you need in your binding (you can do that with the new statement public interface IHasEverything : IHasName2 { new String Name1 { get; set; } new String Name2 { get; set; } } Now your concrete class "HasTwoNames" needs to implement IHasEverything, too: public class HasTwoNames : IHasName2, IHasEverything { ... } You can bind this List to a datagridview: public List elements = new List { new HasTwoNames { Name1 = "Name1", Name2 = "Name2"}, new HasTwoNames { Name1 = "Name3", Name2 = "Name4"}, }; I know that this is just a workaround and only possible if you can modify the implementing class.
But it works. (If you remove a property from IHasName2, the code will still compile but you get a warning that IHasEverything does not need the new keyword.
My Workaround happens in the binding of the dgv. I do need that the base interfaces and the inheriting interfaces remain in the same structure, just because I do other things width the final concerete class, not only show the data on a DataGridView. So, for example: interface IGenericPerson { int ID { get; set; } string Name { get; set; } } interface IOperator : IGenericPerson { bool IsAdmin { get; set; } } the concrete class: class Operator : IOperator { public Operator(){} public Operator(int id, string name, bool isAdmin) { this.ID = id; this.
Name = name; thsi. IsAdmin = isAdmin; } public int ID { get; set; } public string name { get; set; } public bool IsAdmin { get; set; } } and in a Gateway Class: public IList GetOperators() { IList list = new List(); list. Add(new Operator(112, "Mark Twain", false); list.
Add(new Operator(112, "Charles Manson", false); list. Add(new Operator(112, "Richard Nixon", true); return list; } Now, if I try to bind a datagridView like this: Gateway gt = new Gateway(); dgv. DataSource = gt.GetOperators(); I get a DataGridView with the only bool IsAdmin column from the IOperator Interface, not the ID, neither the Name propertys from its base interface.
But if I do this: Gateway gt = new Gateway(); IList list = gt.GetOperators(); IList ds = new List(); foreach(IOperator op in list) ds. Add((Operator)op); dgv. DataSource = ds; Everything works in the right way.
In this way I don't need to change the structure of the intarfaces chain, useful for other purposes, and only qhen displaying data I just insert the snippet above.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.