private void LoadDeviceList(int productId = 0) { DeviceType.RemoveAllItems(); DeviceType.AddItem("[Select Device Type]"); foreach (var device in Globals.DeviceTypes) { DeviceType.AddItem(device.Name); } if (productId > 0) { string productName = Globals.DeviceTypes.Single(x => x.ProductID == productId).Name; _selectedDeviceIndex = (int)DeviceType.IndexOfItem(productName); _selectedDeviceType = Globals.DeviceTypes.SingleOrDefault(x => x.Name == DeviceType.ItemAtIndex(_selectedDeviceIndex).Title); DeviceType.SelectItem(_selectedDeviceIndex); } }