问题描述
以下是从json反序列化的模型类。
public class JsonQuestion
{
[JsonProperty("query")]
public string Query { get; set; }
[JsonProperty("defaultAnswer")]
public bool DefaultAnswer { get; set; }
public bool Answer { get; set; }
}
我已经为iOS和Android创建了通用列表视图,可用于设置开关单元,文本输入单元,按钮单元等(类似于此https://github.com/bcylin/QuickTableViewController)
这是我的列表行模型对象的示例。
public class SwitchRowModel : MvxNotifyPropertyChanged,IRowModel
{
public string Label { get; set; }
private bool _isTrue;
public bool IsTrue
{
get => _isTrue;
set => SetProperty(ref _isTrue,value);
}
public SwitchRowModel(bool isTrue,string label)
{
_isTrue = isTrue;
Label = label;
}
}
现在让我们说一个简单的视图模型如下:
public class Simpleviewmodel : Mvxviewmodel
{
public IList<JsonQuestion> Questions { get; set; }
private IList<SwitchRowModel> _items;
public IList<SwitchRowModel> Items {
get => _items;
set => SetProperty(ref _items,value);
}
}
tableview / recyclerview源绑定到Items对象。并且tableview / recyclerview的行绑定到SwitchRowModel对象。我可以将SwitchRowModel对象绑定回JsonQuestion对象吗?
是否可能出现这种情况?或者设计不当?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)