How to bind to View's layout_weight in MvvmCross?

前端 未结 1 763
天涯浪人
天涯浪人 2021-01-25 12:25

What is the easiest way to bind to View\'s (or any other Android control) weight? Because this property doesn\'t have a setter, I tried custom binding, but id doesn\'t seem to w

相关标签:
1条回答
  • 2021-01-25 13:11

    MvxSimplePropertyInfoTargetBindingFactory can only be used for real C# properties.

    For invented "pseudo" properties, you need to use a custom binding registration like that shown in the n=28 tutorial -

        protected override void FillTargetFactories(Cirrious.MvvmCross.Binding.Bindings.Target.Construction.IMvxTargetBindingFactoryRegistry registry)
        {
            registry.RegisterCustomBindingFactory<BinaryEdit>(
                            "N28", 
                            binary => new BinaryEditFooTargetBinding(binary) );
            base.FillTargetFactories(registry);
        }
    

    https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/blob/master/N-28-CustomBinding/CustomBinding.Droid/Setup.cs

    0 讨论(0)
提交回复
热议问题