1

我在 MvxAndroidTargetBinding 中实现 RangeSliderView 绑定,但我的代码不起作用:

public class RangeSliderLeftValueBinding : MvxAndroidTargetBinding
{
    private readonly RangeSliderView rangeSliderView;

    public RangeSliderLeftValueBinding(RangeSliderView rangeSliderView)
        : base(rangeSliderView)
    {
        this.rangeSliderView = rangeSliderView;
    }


    public override Type TargetType
    {
        get { return typeof(float); }
    }

    public override void SubscribeToEvents()
    {
        rangeSliderView.LeftValueChanged += RangeSliderViewOnLeftValueChanged;
    }

    private void RangeSliderViewOnLeftValueChanged(float value)
    {
        FireValueChanged(value);
    }

    protected override void SetValueImpl(object target, object value)
    {
    }
}

设置中的此代码:

        registry.RegisterCustomBindingFactory<RangeSliderView>("ProgressLeft", view => new RangeSliderLeftValueBinding(view));

文件 xaml 中的代码:

local:MvxBind="ProgressLeft abc, Mode=TwoWay" 

请帮我 !!!谢谢。

4

0 回答 0