OxyPlot没有更新标题 [英] OxyPlot is not updating title
问题描述
我正在使用OxyPlot在WPF / .net 4.5下的用户控件上显示图表,并具有以下XAML:
I am using OxyPlot to show a Chart on a user control under WPF/.net 4.5 and have the following 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"));
此属性是从外部设置的,但OxyPlot似乎会忽略此设置的任何更改分配了 PlotModel
。使用通过 PlotModel
构造函数提供的标题,还可以更改模型的属性(并调用 RefreshPlot
)不会更改UI中的标题。
This property is then set from outside, but OxyPlot seems to ignore any changes to this as soon as a PlotModel
is assigned. The title supplied via the PlotModel
s constructor is used, but also changing the property of the model (and calling RefreshPlot
) does not change the title in the UI.
我在做什么错了?
推荐答案
我不知道为什么,但是现在可以正常工作了。
I have no idea why, but now it is working...
我没有更改标题的任何内容,但必须触发其他更改它可以正常工作。
I did not change anything about the title, but some other changes must have triggered it to work.
这篇关于OxyPlot没有更新标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!