I am working in Visual C# -> surface -> v2.0 -> Surface Application (WPF) template in MS visual C# 2010 express.
I am trying to get the inputs on the surface table (Samsung SUR40) and parse these to a JSON array.
Each input I want to add as an item in a listbox including an item id to find these back later if the input is moving.
I found this example and get an error like:
C:\Users\User\documents\visual studio
2010\Projects\SurfaceInputs\SurfaceInputs\SurfaceWindow1.xaml.cs(209,25):
error CS1061: ‘System.Windows.Controls.ListBox’ does not contain a
definition for ‘DataSource’ and no extension method ‘DataSource’
accepting a first argument of type ‘System.Windows.Controls.ListBox’
could be found (are you missing a using directive or an assembly
reference?)
The same error occurs for the DisplayMember and the ValueMember.
After the failed example I tried this piece of code which give me the same error:
List<string> list = new List<string>();
list.Add("Hello World");
myListBox.DataSource = list;
I’m a newb at C# and dont know what i’m doing wrong. Could anyone help me?
Try
myListBox.ItemsSource = list.See MSDN for the docs.