首页 文章

将属性从View绑定到ViewModel

提问于
浏览
0

我的自定义视图中有一个属性 MyFunc

public class MyView : MvxLinearLayout
{
    public Func<Task<byte[]>> MyFunc { get; set; }
}

我想从ViewModel调用此函数 . 我如何绑定它,以便我可以在我的ViewModel中使用它?

public class MyViewModel : MvxViewModel
{
    public Func<Task<byte[]>> MyFunc { get; set; } // Bind to it here so I can call it within this class
}

1 回答

  • 0

    你不能以相反的方式工作 .

    源始终是ViewModel Target始终是View

    我不知道你想用这个来实现什么 . 但是,您似乎希望使用图像或某种字节数据填充LinearLayout .

    为此,使用命令 . 如果您确实需要在共享代码中触发特定于平台的功能,则可以使用MvxInteraction .

相关问题