Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>First FIX</h2> <p>Change CTOR:</p> <pre><code>public MainWindow() { InitializeComponent(); SystemInventory sysInventory = new SystemInventory(); //Possibly do something like this. this.Content = sysInventory; } </code></pre> <h2>Second FIX</h2> <p>Use XAML below (add to MainWindow), where {x:Type pc:MainWindow+SystemInventory} used for nested classes</p> <pre><code>&lt;Window.Resources&gt; &lt;DataTemplate DataType="{x:Type pc:MainWindow+SystemInventory}"&gt; &lt;TreeView ItemsSource="{Binding DeviceGroupInstances}"/&gt; &lt;/DataTemplate&gt; &lt;HierarchicalDataTemplate DataType="{x:Type pc:MainWindow+DeviceGroup}" ItemsSource="{Binding DeviceTypeInstances}"&gt; &lt;Label Content="{Binding DeviceGroupName}"/&gt; &lt;/HierarchicalDataTemplate&gt; &lt;HierarchicalDataTemplate DataType="{x:Type pc:MainWindow+DeviceType}" ItemsSource="{Binding DeviceInstances}"&gt; &lt;Label Content="{Binding DeviceTypeName}"/&gt; &lt;/HierarchicalDataTemplate&gt; &lt;DataTemplate DataType="{x:Type pc:MainWindow+DeviceInstance}"&gt; &lt;Label Content="{Binding DeviceInstanceName}"/&gt; &lt;/DataTemplate&gt; &lt;/Window.Resources&gt; </code></pre> <hr> <h2>About namespaces</h2> <p>Namespace is what you need to know to use classes. If your classes have namespace:</p> <pre><code>namespace MyCompany.MyProject.MyComponent { public class SystemInventory { .... } } </code></pre> <p>This namespace should be added to XAML with alias to use:</p> <pre><code>&lt;Window x:Class="MyCompany.MyProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:myAlias="clr-namespace:MyCompany.MyProject.MyComponent" Title="Window1" Height="300" Width="350"&gt; &lt;Window.Resources&gt; ... </code></pre> <p>Now you can use this classes in XAML like:</p> <pre><code>&lt;DataTemplate DataType="{x:Type myAlias:DeviceInstance}"&gt; &lt;Label Content="{Binding DeviceInstanceName}"/&gt; &lt;/DataTemplate&gt; </code></pre>
 

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