So, I want to create some Silverlight charts from some data on my ASP.NET web page. The way to do this, either using Visifire (my current thing) or the upcoming Silverlight charting, seems to be to create some XAML, or at least some Silverlight objects (like in this Visifire sample), and then stuff them into the page somehow.
Strangely, the only way to do this seems to be through JavaScript! That is, I'd have to do something like this:
User -> click button -> JavaScript event handler -> AJAX call to get XAML from server-sided method -> stuff the XAML-string into the client-sided HTML (like this in general or like this for a Visifire-specific method).
This is highly counterintuitive! What I'd much rather have is the ability to do something like this, inside MyPage.aspx.cs
:
protected void MyButton_Click(object sender, EventArgs e)
{
this.MyFictionalSilverlightControl.Xaml = this.GenerateXamlFromData();
}
That would be much nicer! I'm happy to keep MyFictionalSilverlightControl
inside an UpdatePanel
, even though it's inefficient; I just wish I knew how to make such a fictional Silverlight control.
Any ideas? Or suggestions on how to do this better?