问题描述
我有两个选项卡绑定到一个 viewmodel
,其中包含 oxyplot
的 PlotModel
和通过 DataTemplate 选择的视图模型.当单击第一个选项卡时,
viewmodel
已正确绑定,但是当切换到标题抛出中定义的异常上方的第二个选项卡时.两个选项卡中的所有控件都相同.是否可以将一个对象绑定到两个控件?
I have two tabs that is bind to one
viewmodel
which contain a PlotModel
of oxyplot
and view model selected through a DataTemplate
.When click on the first tab the viewmodel
was bind properly but when switch to second tab above exception defined in title throw.All of control is same in two tab.Is it possible bind one object to two controls?
推荐答案
我知道您面临什么问题,因为我自己也遇到过.Oxyplot 不允许您将一个模型绑定到两个图.
I know what problem you are facing, as I had faced it myself. Oxyplot does not let you bind one model to two plots.
原因:一旦将 PlotModel 分配给 Plotview,它就会封装在该 PlotView 对象中.
The reason: Once you assign a PlotModel to a Plotview, it becomes encapsulated in that PlotView object.
解决问题的唯一方法是为每个 PlotView 创建单独的 PlotModel.
The only way you can solve the problem is to create separate PlotModel for each PlotView.
这篇关于错误:此 PlotModel 已被某些其他 PlotView 控件使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!