Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Dynamically Updating Bluetooth Device Picker

$
0
0

Hi,

I am trying to get a picker that will dynamically update as soon as it detects a new, compatible Bluetooth device and add it to the end of the picker list, while the picker is open.

Currently I am binding the ItemsSource to a list of available devices and this produces the list I want when clicking on the picker. However, if a new device comes into range while the picker dialogue box is open, then the device will not appear in the picker until I close the picker dialogue and reopen. The same should also happen in reverse, so if a device goes out of range, it should be removed from the picker options.

Furthermore, I would also like the picker to automatically select the first index in the ItemsSource, when one becomes available.

Currently I am calling the following when the screen appears:

devicePicker.ItemDisplayBinding = new Binding("DeviceName");
devicePicker.ItemsSource = App.bluetoothLib.AvailableDevices;
App.bluetoothLib.ScanForDevices();

And the devices are then added using AvailableDevices.Add({}); within the BLE handlers.

Thanks in advance


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>