Silverlight Combobox (static / dynamic) value get set
Static Data combobox
<ComboBox Grid.Column="3"
Grid.Row="7"
Name="cmbMariedStaus"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Style="{StaticResource ComboboxEntryStyle}">
<ComboBox.Items>
<ComboBoxItem>Married</ComboBoxItem>
<ComboBoxItem>Un married</ComboBoxItem>
</ComboBox.Items>
</ComboBox>
Value GET : (cmb.SelectedItem as ComboBoxItem).Content.ToString();
Value Set : cmb.SelectedItem = cmb.Items.SingleOrDefault(c => (c as ComboBoxItem).Content.ToString() == values);
Dyanamic Data Combobox
<ComboBox Grid.Column="1"
Grid.Row="9"
Name="cmbDepartment"
ItemsSource="{Binding}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
DisplayMemberPath="DepName"
SelectedValuePath="DepID"
Style="{StaticResource ComboboxEntryStyle}">
</ComboBox>
Value GET : cmbDepartment.SelectedValue.ToString();
Vale Set : cmbDepartment.SelectedValue = "some value";