public void ResetSelection() { //SelectedKeys.Clear(); SelectedOptions = Enumerable.Empty <IBFUDropdownOption>(); //SelectedKey = null; if (MultiSelect) { //if (SelectedKeysChanged.HasDelegate) // SelectedKeysChanged.InvokeAsync(SelectedKeys); if (SelectedOptionsChanged.HasDelegate) { SelectedOptionsChanged.InvokeAsync(SelectedOptions); } } else { //if (SelectedKeyChanged.HasDelegate) // SelectedKeyChanged.InvokeAsync(SelectedKey); if (SelectedOptionChanged.HasDelegate) { SelectedOptionChanged.InvokeAsync(SelectedOption); } } StateHasChanged(); }
public static void GetSelectedAsyc(string[] options, SelectedOptionsChanged callback) { CheckboxListSelector cls = new CheckboxListSelector(); cls.checkedListBox1.Items.AddRange(options); cls.QSelect.AutoCompleteCustomSource.AddRange(options); cls.opts = options; cls.Show(); cls.OptionsChanged += callback; }
public void RemoveSelection(string key) { var option = ItemsSource.FirstOrDefault(x => x.Key == key); if (option == null) { return; } CascadedEditContext?.NotifyFieldChanged(FieldIdentifier); if (MultiSelect) { if (!SelectedOptions.Contains(option)) { throw new Exception("This option was not already selected."); } if (OnChange.HasDelegate) { OnChange.InvokeAsync(new BFUDropdownChangeArgs(option, false)); } SelectedOptions = SelectedOptions.Where(x => x != option).ToList(); if (SelectedOptionsChanged.HasDelegate) { SelectedOptionsChanged.InvokeAsync(SelectedOptions); } } else { if (SelectedOption != null) { SelectedOption = null; if (OnChange.HasDelegate) { OnChange.InvokeAsync(new BFUDropdownChangeArgs(option, false)); } if (SelectedOptionChanged.HasDelegate) { SelectedOptionChanged.InvokeAsync(SelectedOption); } } } StateHasChanged(); }
public void ResetSelection() { //SelectedKeys.Clear(); SelectedOptions = Enumerable.Empty <IBFUDropdownOption>(); //SelectedKey = null; CascadedEditContext?.NotifyFieldChanged(FieldIdentifier); if (MultiSelect) { if (SelectedOptionsChanged.HasDelegate) { SelectedOptionsChanged.InvokeAsync(SelectedOptions); } } else { if (SelectedOptionChanged.HasDelegate) { SelectedOptionChanged.InvokeAsync(SelectedOption); } } StateHasChanged(); }
public void RemoveSelection(string key) { var option = ItemsSource.FirstOrDefault(x => x.Key == key); if (option == null) { return; } if (MultiSelect) { if (!SelectedOptions.Contains(option)) { throw new Exception("This option was not already selected."); } if (OnChange.HasDelegate) { OnChange.InvokeAsync(new BFUDropdownChangeArgs(option, false)); } SelectedOptions = SelectedOptions.Where(x => x != option).ToList(); if (SelectedOptionsChanged.HasDelegate) { SelectedOptionsChanged.InvokeAsync(SelectedOptions); } //if (!SelectedKeys.Contains(key)) // throw new Exception("This key was not already selected."); //if (OnChange.HasDelegate) // OnChange.InvokeAsync(new BFUDropdownChangeArgs(key, false)); //SelectedKeys.Remove(key); //this used to be following the next command. A bug? I moved it here... //if (SelectedKeysChanged.HasDelegate) // SelectedKeysChanged.InvokeAsync(SelectedKeys); } else { if (SelectedOption != null) { SelectedOption = null; if (OnChange.HasDelegate) { OnChange.InvokeAsync(new BFUDropdownChangeArgs(option, false)); } if (SelectedOptionChanged.HasDelegate) { SelectedOptionChanged.InvokeAsync(SelectedOption); } } //if (SelectedKey != null) //{ // SelectedKey = null; // if (OnChange.HasDelegate) // OnChange.InvokeAsync(new BFUDropdownChangeArgs(key, false)); // if (SelectedKeyChanged.HasDelegate) // SelectedKeyChanged.InvokeAsync(SelectedKey); //} } StateHasChanged(); }
public void AddSelection(string key) { var option = ItemsSource.FirstOrDefault(x => x.Key == key); if (option == null) { return; } if (MultiSelect) { if (SelectedOptions.Contains(option)) { throw new Exception("This option was already selected somehow."); } if (OnChange.HasDelegate) { OnChange.InvokeAsync(new BFUDropdownChangeArgs(option, true)); } SelectedOptions = SelectedOptions.Append(option).ToList(); if (SelectedOptionsChanged.HasDelegate) { SelectedOptionsChanged.InvokeAsync(SelectedOptions); } //if (SelectedKeys.Contains(key)) // throw new Exception("This key was already selected."); //if (OnChange.HasDelegate) // OnChange.InvokeAsync(new BFUDropdownChangeArgs(key, true)); //SelectedKeys.Add(key); //if (SelectedKeysChanged.HasDelegate) // SelectedKeysChanged.InvokeAsync(SelectedKeys); } else { if (SelectedOption != option) { SelectedOption = option; if (OnChange.HasDelegate) { OnChange.InvokeAsync(new BFUDropdownChangeArgs(option, true)); } if (SelectedOptionChanged.HasDelegate) { SelectedOptionChanged.InvokeAsync(SelectedOption); } } isOpen = false; //if (SelectedKey!= key) //{ // SelectedKey = key; // if (OnChange.HasDelegate) // OnChange.InvokeAsync(new BFUDropdownChangeArgs(key, true)); // if (SelectedKeyChanged.HasDelegate) // SelectedKeyChanged.InvokeAsync(SelectedKey); //} //isOpen = false; } StateHasChanged(); }