开发者

DataGrid control that supports row details

I am looking for a free/pay component for .NET Windows Forms that let's be visualize (tabular) a single listing containing various types of data. I would also walcome a way to customize any of the built in .NET components to do the same thing.

I have a dataset comprised of 4 different types of data, which all implement a common interface. I can set the datasource of a DataGridView to be a list of the interface objects and I get a nice looking uniform grid just fine. However, what I want to do is be able to expand each row to view the actual datatype values of the underlying class.

Here is an example set of data:

public interface ICommonData {
    long ID {get;}
    DateTime Date {get;}
}

public class ClassA : ICommonData {
    public long ID {get;}
    public DateTime Date {get;}
    public string Description {get;set;}
    public string Title {get;set;}
}

public class ClassB : ICommonData {
    public long ID {get;}
    public DateTime Date {get;}
    public long SomeReferenceNumber {get;set;}
    public string SomeName {get;set;}
}

Using this data, I would bind the grid to a List that contained a mixture of ClassA and ClassB objects. What I need is the ability to expand any of the rows and see a record with all the fields of ClassA or ClassB depending on the开发者_JAVA技巧 data type bound to that row.

I know what I need is possible using the Microsoft WPF DataGrid object (with RowDetailSelector), but I'd rather not use WPF for this kind of thing if I don't have to. Another important note is, this is all read only. I do not need any way to edit any of this data. My use case is that I have library that is hooked to many different types of error log records, and I need a way to visualize all these different types of error records in one tabular format (while being able to see all the fields on all the different types of data).

Any help would be appreciated!


I ended up choosing the WinForms controls from Telerik. Their grid allows me to do what I've described above using the tabbed child templates.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜