private void Window_Loaded_1(object sender, RoutedEventArgs e) { cbxScanners.ItemsSource = WIAScanning.GetDevices(); if (cbxScanners.Items.Count == 1) { cbxScanners.SelectedItem = cbxScanners.Items[0]; } }
private void Page_Loaded(object sender, RoutedEventArgs e) { List <Tuple <string, string> > devices = WIAScanning.GetDevices( ); cbxScanners.Items.Clear( ); foreach (var device in WIAScanning.GetDevices( )) { cbxScanners.Items.Add(new ScannerDeviceItem( ) { DeviceID = device.Item1, DeviceName = device.Item2 }); } if (cbxScanners.Items.Count == 1) { cbxScanners.SelectedItem = cbxScanners.Items[0]; } }