Hi,
I have a gridview with 3 GridViewComboBoxColumn's first comboboxcolumn holds different states, based on the selection the second and third comboboxes are populated. the second comboboxcolumn holds different Id's and the third comboboxcolumn holds descriptions. Each row has its own set of states, id's and descriptions. each Id can have one or more descriptions and the user can select either the Id first or description first, so both this comboboxes are populated with same data with different properties. till now everything works fine. but we have a requirement that whenever the selected Id has only one description associated, we should default the description selection to that on the other hand it there are more than one description associated with the id we should sort the descriptions to have selected Id's descriptions to the top. After this change for some reason the getter for description comboboxcolumn itemsourcebinding property is called continuously and the entire application hangs. Below is the code snippet of the view and viewmodel. Please let me know if you need addtional information and what am I doing wrong?
View:
<telerik:GridViewComboBoxColumn Header="State" IsComboBoxEditable="True" DisplayMemberPath="StateAbbr" SelectedValueMemberPath="StateAbbr" DataMemberBinding="{Binding State, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" ItemsSourceBinding="{Binding DataContext.RLStates,RelativeSource={RelativeSource AncestorType=UserControl}}">
<telerik:GridViewComboBoxColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding State}" />
</DataTemplate>
</telerik:GridViewComboBoxColumn.CellTemplate>
</telerik:GridViewComboBoxColumn>
<telerik:GridViewComboBoxColumn Header="Id" IsComboBoxEditable="True"
DisplayMemberPath="Id" SelectedValueMemberPath="Id" DataMemberBinding="{Binding MemberId, Mode=TwoWay,NotifyOnValidationError=True, ValidatesOnExceptions=True}" ItemsSourceBinding="{Binding Ids, Mode=TwoWay}"><telerik:GridViewComboBoxColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding MemberId}" />
</DataTemplate>
</telerik:GridViewComboBoxColumn.CellTemplate>
</telerik:GridViewComboBoxColumn>
<telerik:GridViewComboBoxColumn Header="Desc" IsComboBoxEditable="True" DisplayMemberPath="Descrition"
SelectedValueMemberPath="Descrition" DataMemberBinding="{Binding MemberDescrition, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" ItemsSourceBinding="{Binding Descritions, Mode=TwoWay}">
<telerik:GridViewComboBoxColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding MemberDescrition}" />
</DataTemplate>
</telerik:GridViewComboBoxColumn.CellTemplate>
</telerik:GridViewComboBoxColumn>
ViewModel:
public string State
{
get { return state; }
set
{
if (!string.IsNullOrEmpty(value))
{
state = value.ToUpper();
NotifyPropertyChanged("State");
if (GetStateIds != null && !string.IsNullOrEmpty(value)))
GetStateIds(this);
}
}
}
public ObservableCollection<IdDescList> Ids
{
get
{
return Ids;
}
set
{
Ids = value;
NotifyPropertyChanged("Ids");
}
}
public ObservableCollection<IdDescList> Descritions
{
get
{
if (string.IsNullOrEmpty(MemberId))
return descriptions;
else
{
return descriptions;
}
}
set
{
descriptions = value;
NotifyPropertyChanged("Descritions");
}
}
public string MemberDescrition
{
get { return memberDescrition; }
set { memberDescrition = value; NotifyPropertyChanged("MemberDescrition"); }
}
public string MemberId
{
get { return memberId; }
set
{
memberId = value;
NotifyPropertyChanged("MemberId");
}
}