This question is locked. New answers and comments are not allowed.
Hi,
i am using telerik controls on silverlight. Our application is based on MVVM architecture and uses web services to fetch data from a db.
Usually we after fetching the data from db, all i have to do is to assign to an object in ViewModel, which is bound to ItemsSource or Text property of a control. However in case of GridView with ComboBox column i am unable to get values from the bound object. I have read many threads on this but could not find a solution. Here is my code:
XAML:
ViewModel:
Misc Classes: [Defined on Server Side and are fetched via WebSvcs in Reference.cs]
Model:
Explanation:
The requirement is such that we need two columns one with string values and other with a comboboxes. So i made an
Note: I want different values in comboboxes so i bound them with a collection of lists.
Can any one find a mistake in this implementation?
i am using telerik controls on silverlight. Our application is based on MVVM architecture and uses web services to fetch data from a db.
Usually we after fetching the data from db, all i have to do is to assign to an object in ViewModel, which is bound to ItemsSource or Text property of a control. However in case of GridView with ComboBox column i am unable to get values from the bound object. I have read many threads on this but could not find a solution. Here is my code:
XAML:
<br><Telerik:ExtRGridView x:Name="gw" SelectedItem="{Binding SelectedRow, Mode=TwoWay}" ItemsSource="{Binding ResultsData, Mode=TwoWay}" Margin="8" AutoGenerateColumns="False" IsReadOnly="True" CanUserInsertRows="False" CanUserDeleteRows="False">
<Telerik:ExtRGridView.Columns>
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Name, Mode=TwoWay}" IsAutoGenerated="True" MinWidth="150"/>
<telerikGridView:GridViewComboBoxColumn ItemsSourceBinding="{Binding Agents, Mode=TwoWay}" DisplayMemberPath="Name" IsAutoGenerated="True" MinWidth="200" />
</Telerik:ExtRGridView.Columns>
</Telerik:ExtRGridView>ViewModel:
public ObservableCollection<AutoQueueAssignTLData> ResultsData {
get{return _ResultsData;}
set{ _ResultsData = value;
OnPropertyChanged("ResultsData ");
}
}Misc Classes: [Defined on Server Side and are fetched via WebSvcs in Reference.cs]
public class AutoQueueAssignTLData { private AutomaticQueueingResGroupListBoxData _Name; private IList<AgentType> _Agents; private string _TeamLead; public string TeamLead { get { return _TeamLead; } set { _TeamLead = value; } } public IList<AgentType> Agents { get { return _Agents; } set { _Agents = value; } } public AutomaticQueueingResGroupListBoxData Name { get { return _Name; } set { _Name = value; } } }public class AgentType{ private string _Id; public string Id { get { return _Id; } set { _Id = value; } } private string _Name; public string Name { get { return _Name; } set { _Name = value; } } private bool _IsTL; public bool IsTL { get { return _IsTL; } set { _IsTL = value; } } }Model:
((IView<AssignTLViewModel>)this.View).Model.ResultsData = data;Explanation:
The requirement is such that we need two columns one with string values and other with a comboboxes. So i made an
AutoQueueAssignTLData class and bound the ItemsSource of GridView to an ObservableCollection of the same type. Now this object has one string and a List type attribute, which are bound to DataColumn and ComboBox column respectively. However after webservice fetched data, I cant see comboboxes in the the respective column. Note: I want different values in comboboxes so i bound them with a collection of lists.
Can any one find a mistake in this implementation?