【发布时间】:2013-09-12 11:50:09
【问题描述】:
我正在使用 OxyPlot 在 WPF/.net 4.5 下的用户控件上显示图表,并具有以下 XAML:
<oxy:Plot x:Name="oxyPlot" Title="{Binding ChartTitle}" Model="{Binding Plot}" />
在我的代码隐藏中:
public string ChartTitle
{
get { return (string)GetValue(ChartTitleProperty); }
set { SetValue(ChartTitleProperty, value); }
}
public static readonly DependencyProperty ChartTitleProperty =
DependencyProperty.Register("ChartTitle", typeof(string), typeof(ChartControl), new PropertyMetadata("OMICRON Lab Chart"));
然后从外部设置此属性,但一旦分配了PlotModel,OxyPlot 似乎会忽略对此的任何更改。使用通过PlotModels 构造函数提供的标题,但更改模型的属性(并调用RefreshPlot)不会更改 UI 中的标题。
我做错了什么?
【问题讨论】:
标签: c# wpf data-binding oxyplot