Change Silverlight Chart Legend Item Layout
任何人都可以告诉我dataviz组件在以下代码中是什么(来自链接的问题)
<dataviz:Legend x:Name="Legend" Header="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}" Grid.Row="2"/>
我尝试使用它时出现以下错误:
The type ‘dataviz:Title’ was not
found. Verify that you are not missing
an assembly reference and that all
referenced assemblies have been built
解决方法
dataviz:是用于silverlight工具包数据可视化namespce的常见xml命名空间别名.这是针对Silverlight 3版本的,当时库无法定义自己的XML命名空间.
.NET命名空间System.Windows.Controls.DataVisualization将映射到前缀dataviz,如下所示: –
xmlns:dataviz="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
使用Silverlight 4,库可以定义自己的架构URL以覆盖整个.NET命名空间,更改为:
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
这个xmlns空间涵盖了您可能希望包含在Xaml中的大多数对象(不仅仅是图表内容).较旧的样式仍然有效但通常在Silverlight 4中,您只需要使用此单个别名从工具箱中引用您需要的任何内容.