protected async Task HandleOnChanged(UIChangeEventArgs e) { if (IsMultiple) { // when multiple selection is enabled we need to use javascript to get the list of selected items internalMultiValue = await JSRunner.GetSelectedOptions <TValue>(ElementId); // changed event must be called before validation await SelectedValuesChanged.InvokeAsync(internalMultiValue); ParentValidation?.UpdateInputValue(internalMultiValue); } else { if (Converters.TryChangeType <TValue>(e.Value, out var value)) { internalValue = value; } else { internalValue = default; } // changed event must be called before validation await SelectedValueChanged.InvokeAsync(internalValue); ParentValidation?.UpdateInputValue(internalValue); } }
protected async Task OnChangeAsync( ChangeEventArgs e) { SelectedValue = e.Value.ToString(); await SelectedValueChanged.InvokeAsync(SelectedValue); }
protected virtual void OnSelectedValueChanged() { if (_lock.IsNotLocked) { SelectedValueChanged?.Invoke(this, EventArgs.Empty); } }
private void EhSelectedValueChanged(object sender, EventArgs e) { if (_lock.IsNotLocked) { SelectedValueChanged?.Invoke(this, e); } }
private void OnSelectedValueChanged(String s) { if (SelectedValueChanged != null) { SelectedValueChanged.Invoke(this, null); } }
private void setSelected() { if (SelectedValueChanged != null) { SelectedValueChanged.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Called when the radio button signals that the user want to change the light type. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param> private void EhLightTypeChanged(object sender, RoutedEventArgs e) { if (_lock.IsNotLocked) { IDiscreteLight newLight = null; if (object.ReferenceEquals(sender, _guiNotUsed)) { newLight = null; } else if (object.ReferenceEquals(sender, _guiDirectional)) { newLight = new Altaxo.Graph.Graph3D.Lighting.DirectionalLight(); } else if (object.ReferenceEquals(sender, _guiPoint)) { newLight = new Altaxo.Graph.Graph3D.Lighting.PointLight(); } else if (object.ReferenceEquals(sender, _guiSpot)) { newLight = new Altaxo.Graph.Graph3D.Lighting.SpotLight(); } else { throw new NotImplementedException(); } if (newLight?.GetType() != SelectedValue?.GetType()) { ChangeHostControlAccordingToNewLight(newLight); SelectedValueChanged?.Invoke(this, EventArgs.Empty); } } }
private void Box_SelectedIndexChanged(object sender, EventArgs e) { Text = box.GetItemText(box.SelectedItem); GetSelectedValue(); SelectedValueChanged?.Invoke(this, e); SelectedIndexChanged?.Invoke(this, e); }
private void EhLightAmplitudeSliderChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { _lightAmplitude = _guiLightAmplitudeSlider.Value; _guiLightAmplitudeBox.SelectedValue = _lightAmplitude; SelectedValueChanged?.Invoke(this, EventArgs.Empty); }
internal async Task <bool> TrySetValueAsync(TValue value, bool requireRefresh) { var arg = new BChangeEventArgs <TValue>() { NewValue = value, OldValue = SelectedValue }; if (SelectedValueChanging.HasDelegate) { await SelectedValueChanging.InvokeAsync(arg); if (arg.DisallowChange) { return(false); } } SelectedValue = value; SetFieldValue(SelectedValue, true); RequireRender = true; if (SelectedValueChanged.HasDelegate) { await SelectedValueChanged.InvokeAsync(value); } if (requireRefresh) { StateHasChanged(); } return(true); }
public Task OnItemSelect(string item) { SelectedText = item; SelectedValue = item; ShowAndClose(); return(SelectedValueChanged.InvokeAsync(SelectedValue)); }
private void btnPicker_Click(object sender, EventArgs e) { colorDialog.Color = SelectedValue; if (colorDialog.ShowDialog() == DialogResult.OK) { SelectedValue = colorDialog.Color; SelectedValueChanged?.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Clears the selected value and the search field. /// </summary> public Task Clear() { CurrentSearch = null; dropdownRef.Close(); SelectedText = string.Empty; SelectedValue = null; return(SelectedValueChanged.InvokeAsync(selectedValue)); }
protected override void OnMarkerPositionChanged(PositionChangedEventArgs e) { if (Palette != null) { SelectedColor = Palette.GetColor(e.Position.X); SelectedBrush = new SolidColorBrush(SelectedColor); SelectedValueChanged.Raise(this); } }
private void ListBox_Click(object sender, EventArgs e) { SelectTextChange = true; filterSelectedItem = filterList[(int)sender]; filterSelectedValue = GetItemValue(filterSelectedItem); Text = GetItemText(filterSelectedItem).ToString(); edit.SelectionStart = Text.Length; SelectedValueChanged?.Invoke(this, EventArgs.Empty); SelectTextChange = false; }
private void PositionSliderValueChanged(int index) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _position[index] = _guiPositionSliders[index].Value; _guiPositionBoxes[index].SelectedValue = _position[index]; }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty)); }
private void EhPolarAngleBoxValueChanged(object sender, DependencyPropertyChangedEventArgs e) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _polarAngleDegrees = _guiPolarAngleBox.SelectedValue; _guiPolarAngleSlider.Value = _polarAngleDegrees; }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty) ); }
internal void AddItem( DropDownListItemComponent item) { DataSource.Add(new Item(item.Text, item.Value)); if (item.Selected) { SelectedValue = item.Value ?? item.Text; SelectedValueChanged.InvokeAsync(SelectedValue).GetAwaiter(); } }
private void EhAzimuthAngleSliderValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _elevationAngleDegrees = _guiElevationAngleSlider.Value; _guiElevationAngleBox.SelectedValue = _elevationAngleDegrees; }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty) ); }
private void EhSphericalValueChanged(object sender, EventArgs e) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _position = _guiSpherical.SelectedValue; _guiCartesian.SelectedValue = _position; }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty) ); }
private void EhLightAmplitudeSliderChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _lightAmplitude = _guiLightAmplitudeSlider.Value; _guiLightAmplitudeBox.SelectedValue = _lightAmplitude; }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty) ); }
private void EhDistanceSliderValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _distance = _guiDistanceSlider.Value; _guiDistanceBox.SelectedValue = _distance; }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty) ); }
protected void HandleDropdownItemClicked(object value) { CurrentSearch = null; dropdownRef.Close(); var item = Data.FirstOrDefault(x => ValueField(x) == value); SelectedText = item != null?TextField?.Invoke(item) : string.Empty; SelectedValue = value; SelectedValueChanged.InvokeAsync(SelectedValue); }
/// <summary> /// Clears the selected value and the search field. /// </summary> public async Task Clear() { CurrentSearch = null; dropdownRef.Hide(); SelectedText = string.Empty; SelectedValue = default; await SelectedValueChanged.InvokeAsync(selectedValue); await SearchChanged.InvokeAsync(CurrentSearch); }
protected Task HandleDropdownItemClicked(object value) { CurrentSearch = null; dropdownRef.Close(); var item = Data.FirstOrDefault(x => EqualityComparer <object> .Default.Equals(ValueField(x), value)); SelectedText = item != null?TextField?.Invoke(item) : string.Empty; SelectedValue = value; return(SelectedValueChanged.InvokeAsync(SelectedValue)); }
private void EhLightAmplitudeBoxChanged(object sender, DependencyPropertyChangedEventArgs e) { _lightAmplitude = _guiLightAmplitudeBox.SelectedValue; if (_lightAmplitude > _guiLightAmplitudeSlider.Maximum) { _guiLightAmplitudeSlider.Maximum = _lightAmplitude; } _guiLightAmplitudeSlider.Value = _lightAmplitude; SelectedValueChanged?.Invoke(this, EventArgs.Empty); }
private void EhDirectionBoxValueChanged(int index) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _direction[index] = _guiDirectionBoxes[index].SelectedValue; _guiDirectionSliders[index].Value = _direction[index]; CorrectDirectionValues(index); }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty) ); }
protected void OnRadioChanged(MouseEventArgs e) { if (IsDisabled) { return; } if (RadioGroup != null) { _ = RadioGroup.TrySetValueAsync(Value, !SelectedValueChanged.HasDelegate); return; } var newStatus = Status == RadioStatus.Selected ? RadioStatus.UnSelected : RadioStatus.Selected; if (StatusChanging.HasDelegate) { var arg = new BChangeEventArgs <RadioStatus>(); arg.OldValue = Status; arg.NewValue = newStatus; StatusChanging.InvokeAsync(arg).Wait(); if (arg.DisallowChange) { return; } } if (newStatus == RadioStatus.Selected && !TypeHelper.Equal(SelectedValue, Value)) { SelectedValue = Value; } if (RadioGroup == null) { SetFieldValue(SelectedValue, true); if (FormItem != null) { FormItem.MarkAsRequireRender(); FormItem.Refresh(); } } if (StatusChanged.HasDelegate) { _ = StatusChanged.InvokeAsync(newStatus); } if (SelectedValueChanged.HasDelegate) { _ = SelectedValueChanged.InvokeAsync(SelectedValue); } }
private void setSelected(ButtonGridItem value) { if (selectedItem != value) { selectedItem = value; if (selectedItem != null) { selectedItem.StateCheck = true; } if (SelectedValueChanged != null) { SelectedValueChanged.Invoke(this, EventArgs.Empty); } } }
private void EhDistanceBoxValueChanged(object sender, DependencyPropertyChangedEventArgs e) { _lock.ExecuteLockedButOnlyIfNotLockedBefore( () => { _distance = _guiDistanceBox.SelectedValue; if (_guiDistanceSlider.Maximum < _distance) { _guiDistanceSlider.Maximum = _distance; } _guiDistanceSlider.Value = _distance; }, () => SelectedValueChanged?.Invoke(this, EventArgs.Empty) ); }