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

RadGridView.Columns Binding

1 Answer 138 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 31 May 2012, 07:16 PM
I'm building a reusable user control that will contain a search query textbox and a GridView that contains the results of the query.  I have created a DependencyProperty on the user control that will hold the collection of items to be searched.  Since the type of objects we will be searching and displaying on the screen varies, I also need to have the user control support custom column definitions for the GridView.  I tried creating a DependencyProperty for the columns definition, but it looks like the GridView didn't support binding the columns property to it.

As it stands right now, the columns are defined from within the user control's XAML.  It is fully functional.  However, this breaks reusability if we want to work with a collection of a different type of object, and we don't want to auto-generate columns.  Any ideas on how we can move the GridView column definitions outside of the user control but still have them written in XAML?  I've done some searching for a solution but haven't found anything ideal yet.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 01 Jun 2012, 06:51 AM
Hello,

 You can check your local copy of our demos for more info on how to achieve this - look for MyColumnsBindingBehavior class. You can check also this demo to know more about how we are using this attached behavior. 

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Kevin
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or