问题描述
我将如何绑定到MVVMCross中的祖父母?
How would I bind to a grandparent in MVVMCross?
我有一个List<string>
,我将其绑定到具有自己的项目模板"A"的MvxLinearLayout
.当用户单击"A"中的按钮时,我想在其父级(即List<string>
的所有者)中触发ICommand
.
I have a List<string>
which I'm binding to a MvxLinearLayout
with its own item template "A". When the user clicks on the button in "A" I would like to fire an ICommand
in its parent (i.e. the owner of the List<string>
).
我也有类似的祖父母关系.
I also have a similar situation with a grandparent relation.
我该怎么做?
推荐答案
列表或任何其他mvx数据绑定上下文中目前没有父绑定访问.
There is no parent binding access in lists or any other mvx data binding context currently.
有很多简单的解决方法-请参阅诸如,以获得一些建议.
There are plenty of simple workarounds - see questions such as MvvmCross Android - Alternative to RelativeSource binding for button command for some suggestions.
我已经多次回答类似的问题.每次我邀请人们提出功能请求,想法或问题时,例如 https://github .com/slodge/MvvmCross/issues/35 .尽管可能有3或4个问题,但似乎没有人愿意去跟进,所以我认为这不是一个重要功能.
I've answered questions similar to this several times. Each time i invite people to raise feature requests, ideas or pulls to issues such as https://github.com/slodge/MvvmCross/issues/35 . While there have been perhaps 3 or 4 of these questions, no-one ever seems bothered enough to follow up, so i guess it's not an important feature.
这篇关于绑定到父母和祖父母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!