private void Properties_PropertyChanged(PropertyPage props, int idx, object value) { if (idx == 3) // 3 = pattern length. { var barLengths = GenerateBarLengths((int)value); var barIdx = Array.IndexOf(barLengths, selectedSong.BarLength); if (barIdx == -1) { barIdx = barLengths.Length - 1; } props.UpdateDomainRange(4, barLengths, barLengths[barIdx]); // 4 = bar length. } }