当我尝试将visibility属性绑定到telerik控件时,我遇到了问题。 当我将相同的属性绑定到常规控件时,它可以正常工作。
我已经尝试了两个,Visibility.Collapsed和Telerik.Windows.Controls.Charting.SeriesVisibility.Collapsed,但我仍然收到以下错误
设置属性 'Telerik.Windows.Controls.Charting.SeriesDefinition.Visibility'扔了 例外。
在Initialize();
上抛出此错误这是我的代码
查看(代码背后):
public ChartView(ViewModel viewModel)
{
InitializeComponent();
}
视图模型:
private Telerik.Windows.Controls.Charting.SeriesVisibility _startDateVisible;
public Telerik.Windows.Controls.Charting.SeriesVisibility StartDateVisible
{
get {return _startDateVisible;}
set
{
_startDateVisible = value;
OnPropertyChanged("StartDateVisible");
}
}
public ViewModel(IEventAggregator eventAggregator)
: base(eventAggregator)
{
StartDateVisible = Telerik.Windows.Controls.Charting.SeriesVisibility.Collapsed;
//StartDateVisible = Visibility.Collapsed;
}
查看(XAML):
<telerikCharting:SeriesMapping x:Name="..." LegendLabel="..." CollectionIndex="1" ChartAreaName="...">
<telerikCharting:SeriesMapping.SeriesDefinition>
<telerikCharting:ScatterSeriesDefinition ShowItemLabels="True" ShowItemToolTips="True" PointShape="Circle" Visibility="{Binding StartDateVisible}" />
</telerikCharting:SeriesMapping.SeriesDefinition>
<telerikCharting:SeriesMapping.ItemMappings>
<telerikCharting:ItemMapping DataPointMember="XValue" FieldName="..."/>
<telerikCharting:ItemMapping DataPointMember="YValue" FieldName="..."/>
</telerikCharting:SeriesMapping.ItemMappings>
</telerikCharting:SeriesMapping>
答案 0 :(得分:1)