This question is locked. New answers and comments are not allowed.
Given the xaml below, I'm populating a combobox within the gridview with a Collection of data that represents the two possible 'valid' values from the database. Two questions.
- How do I set the value of combobox to the same value as it arrives from the database query and is bound to the gridview that contains the combobox and
- If the value from the database for the column/field/property 'Class' is 'NA' or null, I don't want a combobox to be created, or at least have it appear to the user that it is an empty cell. (There will be nothing to select.)
<l:Collection x:Key="EMC_Classes"> <!-- Collection<object> --> <l:EMC_Class ID="1" Class="A or B" /> <l:EMC_Class ID="2" Class="A,B,C,D" /> </l:Collection> <l:ValueToItemConverter x:Key="EMCID2Class" ItemsSource="{StaticResource EMC_Classes}" ValuePath="ID" DisplayMemberPath="Class" /> <telerik:RadGridView Name="rgvEMCTestPlans"> <telerik:GridViewColumn Header="Class" Width="100" IsReadOnly="False" x:Name="ComboClass"> <telerik:GridViewColumn.CellTemplate> <DataTemplate > <ComboBox FontSize="10" Width="90" HorizontalAlignment="Center" ItemsSource="{StaticResource EMC_Classes}" DisplayMemberPath="Class" SelectedValuePath="ID" SelectedValue="1" SelectedIndex="1" SelectedItem="1" SelectionChanged="ComboBox_SelectionChanged" /> </DataTemplate> </telerik:GridViewColumn.CellTemplate> </telerik:GridViewColumn>public void GridLoaded(object sender, TypeLoadedEventArgs e) { MyAppliedStandardsModels = new ObservableCollection<AppliedStandardsModel>(); var emcClasses = new List<EMC_Class>(); foreach (AppliedStandardsModel item in e.SType) { MyAppliedStandardsModels.Add(item); } rgvEMCTestPlans.ItemsSource = MyAppliedStandardsModels; } public class EMC_Class { public string Class { get; set; } public int ID { get; set; } } private ObservableCollection<AppliedStandardsModel> _myAppliedStandardsModel; public ObservableCollection<AppliedStandardsModel> MyAppliedStandardsModels { get { return _myAppliedStandardsModel; } set { _myAppliedStandardsModel = value; FirePropertyChanged("MyAppliedStandardsModel"); } }

