This question is locked. New answers and comments are not allowed.
Ok so here is my problem...
I have a back end DAL layer that uses Entity Framework and RIA Services. On the Client side I have a GridView object that I have set up so that I can bind any entity I want to it by using generics...(see below)...now my problem comes into play when I have a Child entity in the entity I'm binding to...
So for example If I have a Customer Entity that has a child entity of Address. When I generate the GridView I get a column that has the entire Address Entity inside it....What I want is to Display one property off of that child entity like (AddressName). Similar to the way you have a "DisplayMemberPath" inside a combobox.
I need to do this so I code as LITTLE specific code as possible and keep it as Generic as I can. I have tried catching the "AutoGeneratingColumn" event that seems to give me access to the Datacolumn but I'm unsure how to alter it to display the correct value.
Thoughts?
I have a back end DAL layer that uses Entity Framework and RIA Services. On the Client side I have a GridView object that I have set up so that I can bind any entity I want to it by using generics...(see below)...now my problem comes into play when I have a Child entity in the entity I'm binding to...
So for example If I have a Customer Entity that has a child entity of Address. When I generate the GridView I get a column that has the entire Address Entity inside it....What I want is to Display one property off of that child entity like (AddressName). Similar to the way you have a "DisplayMemberPath" inside a combobox.
I need to do this so I code as LITTLE specific code as possible and keep it as Generic as I can. I have tried catching the "AutoGeneratingColumn" event that seems to give me access to the Datacolumn but I'm unsure how to alter it to display the correct value.
Thoughts?
protected void SubscribedEvent_UpdateFilter<T>(IEnumerable<T> entityCollection) { if ((MyRadGridView != null) && (MyRadGridView.ItemsSource == null) && (entityCollection != null)) { // Retrieve the Type of the Collection _myType = entityCollection.GetType(); // Reset Selected Items SelectedItems = new ObservableCollection<dynamic>(); // Bind all of the Events //this.MyRadGridView.RowLoaded this.MyRadGridView.AutoGeneratingColumn += new EventHandler<GridViewAutoGeneratingColumnEventArgs>(MyRadGridView_AutoGeneratingColumn); this.MyRadGridView.SelectionChanged += new System.EventHandler<SelectionChangeEventArgs>(MyRadGridView_SelectionChanged); this.MyRadGridView.Items.PageChanged += new System.EventHandler<System.EventArgs>(MyRadGridViewItems_PageChanged); this.MyRadDataPager.PageIndexChanging += new System.EventHandler<PageIndexChangingEventArgs>(MyRadDataPager_PageIndexChanging); // Bind All of the Sources this.MyRadGridView.ItemsSource = entityCollection; this.MyRadDataFilter.Source = MyRadGridView.Items; this.MyRadDataPager.Source = MyRadGridView.Items; } }