I'm having a lot of troubles in making Silverlight recognize the namespases of Silverlight toolkit maybe because I am writing XAML code in ASP.Net User Control (*.ascx) file.
I've Googled and searched here (Stacked? maybe) but nothing worked for me.
I am sure this can be done somehow, I've seen it working before.
After we write the XAML contents in the (.ascx) file we send these contents to an (.xap) silverlight executable file which loads the XAML contents via XamlReader in run-time and executes that.
this is the head part of the ASCX file:
<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="TargetChartByVisits2.ascx.cs" Inherits="Mynamespace.TargetChartByVisits2" %>
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
xmlns:datavis="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"
xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
xmlns:data="clr-namespace:MyNamespace.MyCharts;assembly=MyNamespace.MyCharts"
Width="350" Height="400">
What I am trying to do is to draw a chart in Silverlight Toolkit, I have this XAML code to assist data-binding:
<controls:ObjectCollection x:Key="SeriesData">
<asp:Repeater ID="Repeater1" DataSource="<%# vwMain %>" runat="server">
<ItemTemplate>
<data:ChartDataElement MeasurementDate="<%# HttpUtility.HtmlEncode(Sql.ToString(Eval("MeasurementDate"))) %>" VisitReading="<%# HttpUtility.HtmlEncode(Sql.ToString(Eval("VisitAmount"))) %>" VisitTarget="<%# HttpUtility.HtmlEncode(Sql.ToString(Eval("Visit_TargetAmount"))) %>" />
</ItemTemplate>
</asp:Repeater>
</controls:ObjectCollection>
I get an error that clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" is an unknown namespace, even though, I have the toolkit installed and the samples are working well and I've added the reference to this assembly (Controls) from
C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Bin
I'm using VS2010, thanks.