Note that there are some explanatory texts on larger screens.

plurals
  1. POmsdn Data Templating Overview
    primarykey
    data
    text
    <p>I'm following msdn data templating overview <a href="http://msdn.microsoft.com/en-us/library/ms742521.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms742521.aspx</a></p> <p>But I felt they missed explaining something..for resources they have:</p> <pre><code> &lt;Window.Resources&gt;&lt;local:Tasks x:Key="myTodoList"/&gt;&lt;/Window.Resources&gt; </code></pre> <p>And all they have in XAML is </p> <pre><code>&lt;ListBox Width="400" Margin="10" ItemsSource="{Binding Source={StaticResource myTodoList}}"/&gt; </code></pre> <p>Without showing how C# code behind, they were able to show a list of items in the ListBox. The ListBox has no x:Name and I can't add the items in MainWindow, and with a separate class Tasks, I did the following (which doesn't work)</p> <pre><code>using System.Collections; // use ArrayList using System.Collections.ObjectModel; // use Observable Collection namespace FooApplication1 { /// &lt;summary&gt; /// Interaction logic for MainWindow.xaml /// &lt;/summary&gt; public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } } public class Tasks : ObservableCollection&lt;Tasks&gt; { string TaskName; string Description; int Priority; public TasksStuff(string taskName, string description, int priority) { this.taskName = TaskName; this.description = Description; this.priority = Priority; } public string TaskName {get{return this.taskName}} public string Description {get{return this.description}} public string Priority {get{return this.priority}} private ArrayList Tasks { ArrayList taskList = new ArrayList(); taskList.Add( new TasksStuff("A foo task", "doing foo",1)); return taskList; } } } </code></pre> <p>I am really confused. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload