I am trying to not only populate the combobox within the gridview with just 2 values, but I want the first value to be displayed when the page loads. How do I accomplish that? As you can see in my xaml, I'm trying about everything I can think of. Thank you.
<
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: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"
);
}
}