示例#1
0
 protected override void OnDetached()
 {
     //if (Element is Slider slider)
     //    slider.ValueChanged -= EditingEvent;
     if (Control is SeekBar seekbar)
     {
         bool success = false;
         if (Element is Slider slider)
         {
             var renderer = Platform.GetRenderer(slider);
             if (renderer is Xamarin.Forms.Platform.Android.SliderRenderer sliderRenderer)
             {
                 seekbar.SetOnSeekBarChangeListener(sliderRenderer);
                 success = true;
             }
         }
         if (!success)
         {
             seekbar.SetOnSeekBarChangeListener(null);
         }
     }
     _listener = null;
     if (_stepSizeEffect != null)
     {
         _stepSizeEffect.PropertyChanged -= OnEffectPropertyChanged;
     }
     _stepSizeEffect = null;
 }
示例#2
0
        protected override void OnAttached()
        {
            instances++;
            _stepSizeEffect = (Forms9Patch.SliderStepSizeEffect)Element.Effects.FirstOrDefault(e => e is Forms9Patch.SliderStepSizeEffect);

            //if (_stepSizeEffect != null && Element is Slider slider)
            //    slider.ValueChanged += EditingEvent;
            if (Control is SeekBar seekbar && Element is Slider slider)
            {
                _listener = new SeekBarListener(slider, _stepSizeEffect.StepSize);
                seekbar.SetOnSeekBarChangeListener(_listener);
            }

            _stepSizeEffect.PropertyChanged += OnEffectPropertyChanged;
        }