ListBox with multiple selection: Simple way databind Dictionary<string,bool>

Hi - thanks. Thats what I've done and tried several times but having no success. (Crash)

What worked for me was using for the value and the data an IENumerable. Maybe there are smarter solutions, but the following works:

Dictionary<string,int> ActivePV

IEnumerable UnifiedDistanceMatrixActivePV;
IEnumerable UnifiedDistanceMatrixSelectedPV;

    private async System.Threading.Tasks.Task ListBoxSelectedPVChange(object value)
    {
        List<string> SelectedNames = ((IEnumerable<string>)value).ToList();
        foreach (string NamePV in ActivePV.Keys)
        {
            if (SelectedNames.Contains(NamePV))
                ActivePV[NamePV] = 1;
            else
                ActivePV[NamePV] = 0;
        }            
        await Task.CompletedTask;
    }