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

GridViewComboBoxColumn dynamic itemsource

2 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fredrik
Top achievements
Rank 2
Fredrik asked on 18 Dec 2014, 06:47 PM
Hello!
I have a gridview with a collection of entities.
Each entity has a subcollection, that matches a group id found on a property on the entity.

explanined:
The subcollection base is same for all entities, but each entity only displays a portion given by the group id.
I want the subcollection displayed by GridViewComboBoxColumn in the gridview

if all the entites would display the same subcollection, this would be easy to do.
but i strugle to solve this with diffrent sub collections on each entity.

any help would be appreicated


2 Answers, 1 is accepted

Sort by
0
Fredrik
Top achievements
Rank 2
answered on 19 Dec 2014, 09:14 AM
Solved it by using a collection on a partial class of the entity 
key was using itemsourcebinding insted of itemsource

                        <controls:GridViewComboBoxColumn Header="{Binding LocalizedStrings.view_epark_appvare, Source={StaticResource LocalizedStrings}}" ItemsSourceBinding= "{Binding Evarer,Mode=TwoWay}" DataMemberBinding="{Binding p_EparkGroup ,Mode=TwoWay}" SelectedValueMemberPath="p_Ident"  DisplayMemberPath="p_Tekst" >



            var result = await EntityManager.ExecuteQueryAsync<db_Organisasjon>(qry);
            foreach (var org in result)
            {
                 org.Evarer = varer;
            }

        private List<db_Vare> _evarer = null;
        public List<db_Vare> Evarer
        {
            get
            {

                return _evarer != null && p_EparkVaregruppe p_EparkGroup != null ? _evarer.Where(x => x.p_Group == p_EparkGroup : null;
            }
            set
            {
                _evarer = value;
            }
       }





0
Dimitrina
Telerik team
answered on 19 Dec 2014, 10:03 AM
Hi,

Thank you for updating the thread and sharing your solution with the community.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Fredrik
Top achievements
Rank 2
Answers by
Fredrik
Top achievements
Rank 2
Dimitrina
Telerik team
Share this question
or