This is a migrated thread and some comments may be shown as answers.

What's the best practice when there's a need to "Inherit" from a parent grid?

1 Answer 20 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brian Thomas
Top achievements
Rank 1
Brian Thomas asked on 30 Sep 2009, 09:21 PM
I would like to create a parent grid that will contain all of the columns for a multi-use table but where I can derive/inherit from it depending on the circumstance (I did not create this table so please don't suggest that it should be normalized).  For example, My table contains fields labeled "Field1" to "Fieldx". Field1 for one record may mean something completely different for Field1 of a different record and this is usually designated by a particular company. So, I would like to create one parent grid with the ability to perform CRUD operations on this table but "inherit" the xaml so I can change the columnar header names and eventually lookup lists based on the company being used.

I have been researching this topic for most of the day but have yet to find the "right" solution. There are many possibilities but I would like advice in advance on the best path to take so I don't go down any rabbit trails.

1. One possibility that I found was to put the grid in a user control and then inherit the user control. However, this was criticized because either it doesn't allow the user to edit the columns of the child user control at design time or it created reference issues within the encapsulated user control.

2. Another possibility was to subclass Telerik's gridview but that seems like overkill and I believe there has to be something easier.

3. Another idea is to create a content template. I don't know much about content templates and don't know if learning and implimenting this idea would be a waste of time.

Thank You in advance.

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 06 Oct 2009, 11:21 AM
Hello Brian,

The third options seems most reasonable for me. However what you should implement is DataTemplate, not ControlTemplate. This way you will have the grid on one place in your DataTemplate. For example you can use our RowDetails features which allows you to specify a data template for the row details. You can check out this blog post by Dr. WPF about DataTemplates.

Regards,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Brian Thomas
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or