AnsweredAssumed Answered

WPF: cannot fill more than one combo boxes with domain values

Question asked by on Jul 21, 2020
Latest reply on Jul 24, 2020 by

I have a ProWindow with two combo boxes on it. The combo box items are retrieved from coded value domains. I followed the guidelines for thread safe data binding with WPF on ProConcepts Framework · Esri/arcgis-pro-sdk Wiki · GitHub (section Thread safe data binding with WPF).

The data binding is as follows:

public ReadOnlyObservableCollection<string> StreetItems
    get { return _streetItems; }
public ReadOnlyObservableCollection<string> RiverItems
   get { return _riverItems; }

The code for filling the first combo box is as follows (the second combo box is filled accordingly):

var items = new ObservableCollection<string>();
_streetItems= new ReadOnlyObservableCollection<string>(items);
object lockObject = new object();
BindingOperations.EnableCollectionSynchronization(_streetItems, lockObject);
var codedValuePairs = await GetCodedValuePairsFromDomainAsync(layerName, fieldName);
lock (lockObject)
   foreach (var keyValuePair in codedValuePairs)

The problem is that I can only fill one combo box with the domain values. The other combo box (whether it is the first or the second) always remains empty.  What am I doing wrong?