With following code I add available serial port names to the RibbonGallery object:
xaml:
<ribbon:RibbonComboBox Name="cmbBoxComPortName" SelectionBoxWidth="40" Label="Port name:">
<ribbon:RibbonGallery Name="galleryComPortName" SelectionChanged="galleryComPortName_SelectionChanged" />
</ribbon:RibbonComboBox>
code-behind c#:
galleryComPortName.ItemsSource = SerialPortAdapter.GetAvailablePortList();
SerialPortAdapter code:
class SerialPortAdapter
{
public static List<string> GetAvailablePortList()
{
var portList = SerialPort.GetPortNames().ToList();
portList.Sort();
return portList;
}
}
The problem is now, that the port names are present in the combobox but they are not selectable.
How can I select them and treat the event to set my port name?