private void ConnectToSelected_Tap(object sender, System.Windows.Input.GestureEventArgs e) { // Connect to the device PairedDeviceInfo pdi = PairedDevicesList.SelectedItem as PairedDeviceInfo; PeerInformation peer = pdi.PeerInfo; // Asynchronous call to connect to the device ConnectToDevice(peer); }
private void PairedDevicesList_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Check whether the user has selected a device if (PairedDevicesList.SelectedItem == null) { // No - hide these fields ConnectToSelected.IsEnabled = false; //ServiceNameInput.Visibility = Visibility.Collapsed; } else { // Yes - enable the connect button ConnectToSelected.IsEnabled = true; // Show the service name field, if the ServiceName associated with this device is currently empty PairedDeviceInfo pdi = PairedDevicesList.SelectedItem as PairedDeviceInfo; //ServiceNameInput.Visibility = (String.IsNullOrWhiteSpace(pdi.ServiceName)) ? Visibility.Visible : Visibility.Collapsed; } }