I am using VS 2010 RC with .NET 4.0, and have been writing console apps with no difficulty.
About to venture into the world of WPF, I am stuck at the starting line, having found the following code snippets online that I’d like to test out:
let c = new Canvas(Name="Canvas", Width=250.0, Height=250.0)
c.Background <- SolidColorBrush(Color.FromRgb(228uy,228uy,228uy))
let series =
ColumnSeries(
IndependentValueBinding = Data.Binding("Item1"),
DependentValueBinding = Data.Binding("Item2"),
ItemsSource = makeData ())
let chart = Chart()
chart.Series.Add series
Window(
Name="Plot",
Title="Normally distributed random numbers",
Width=900.0,
Height=700.0,
Content=chart,
Visibility=Visibility.Visible)
“Canvas” and “ColumnSeries” are referenced in this code, but I can’t even get my project to locate these particular classes.
My project has a reference to System.Windows.Presentation, which is what I thought I would need, but I when I add open System.Windows., Intellisense only offers up .Forms, and .Threading as options.
Can anyone help get me going here? Thank you.
The easiest way to figure this out is to look at the Namespace and Assembly entries of the corresponding MSDN page. For instance, for Canvas you can see that it’s in the System.Windows.Controls namespace and that the class is defined in PresentationFramework.dll for WPF or System.Windows.dll for Silverlight.
I believe that the charting controls are part of the Silverlight Toolkit, which you’ll need to download separately.