private void InitEditor() { ComboBoxScenarioContextType.Properties.Items.Clear(); ComboBoxScenarioActionType.Properties.Items.Clear(); ComboBoxScenarioContextType.Properties.Items.AddRange(ViewModelExtension.BuildContextTypes().BuildImageComboBoxItems().ToList()); ComboBoxScenarioActionType.Properties.Items.AddRange(ViewModelExtension.BuildScriptUnitTypes().BuildImageComboBoxItems().ToList()); if (_scenario != null) { var selectedContextType = ComboBoxScenarioContextType.Properties.Items.Cast <ImageComboBoxItem>() .FirstOrDefault(c => (int)c.Value == _scenario.ContextType); var selectedScriptType = ComboBoxScenarioActionType.Properties.Items.Cast <ImageComboBoxItem>() .FirstOrDefault(c => (int)c.Value == _scenario.ScriptUnitType); ComboBoxScenarioActionType.EditValue = selectedScriptType; ComboBoxScenarioContextType.EditValue = selectedContextType; } }