Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try ObservableCollection:</p> <pre><code>private ObservableCollection&lt;SystemModel&gt; _systems = new ObservableCollection&lt;SystemModel&gt;(); public ObservableCollection&lt;SystemModel&gt; Systems { get { return _systems; } } public SystemListViewModel() { var systems = SystemAPI.Instance.GetSystems(); foreach (var system in systems) { Systems.Add(system); } } </code></pre> <p>and xaml should be:</p> <pre><code>&lt;UserControl x:Name="SystemListScreen"&gt; &lt;ScrollViewer Grid.Row="1"&gt; &lt;ItemsControl x:Name="SystemList" ItemsSource="{Binding Path=Systems}"&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;UniformGrid Columns="4"/&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Widgets:MultiLineButton partID="{Binding ID}" company="{Binding Company}" typeSorter="{Binding Name}" typeLocation="{Binding Location}" buttonCommand="{Binding DataContext.navigateInspectList, ElementName=SystemListScreen}" buttonCommandParameter="{Binding ItemsSource.ID, ElementName=SystemList}"/&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; &lt;/ScrollViewer&gt; &lt;/UserControl&gt; </code></pre> <p>As chao wang said:</p> <p>remove <code>DataType="SystemModel"</code> because if you're using just one type of DataType as DataTemplate it's not necessary. and the correct syntax is <code>DataType="vm:SystemModel"</code> where vm is defined in a parent tag like : <code>xmlns:vm="clr-namespace:MySolution.MyVmProject.MyFolder"</code></p> <p>also check these:</p> <p>remove <code>ItemsSource.</code> from Bindings inside <code>DataTemplate</code> because it's just wrong.</p> <p>double check all names in bindings because if they're wrong null value is considered during runtime and you never know.</p> <p>check your dataContext make sure <code>UserControl</code> have its DataContext to the correct instance of type dependency object which have Systems in it. and make sure it's remains that way.</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.
    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