Note that there are some explanatory texts on larger screens.

plurals
  1. POI need to add an observablecollection to an observablecollection.
    primarykey
    data
    text
    <p>Here is my code and what the output is when I run it. I am really at a loss on this one. Any help would be appreciated.</p> <p>VALIDATIONITEM CLASS:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.ObjectModel; namespace ValidationWPF.DataSources { public class ValidationItem : ObservableCollection&lt;ValidationItem&gt; { public ValidationItem() { SubItems = new ObservableCollection&lt;ValidationItem&gt;(); } public ObservableCollection&lt;ValidationMessages&gt; Messages { get; set; } public string item { get; set; } public IList&lt;ValidationItem&gt; SubItems { get; set; } public static IList&lt;ValidationItem&gt; GetItems(string name) { var Validation = new ObservableCollection&lt;ValidationItem&gt;(); var item = new ValidationItem(); item.item = "Customer"; var subItem = new ValidationItem(); subItem.item = "Name"; item.SubItems.Add(subItem); var Message = new ValidationItem(); Message.item = new ObservableCollection&lt;ValidationMessages&gt;().ToString(); subItem.SubItems.Add(Message); Validation.Add(item); return Validation; } } } </code></pre> <p>VALIDATIONMESSAGES CLASS(Needs to be implemented into the Validation Item Class)</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.ObjectModel; namespace ValidationWPF.DataSources { public class ValidationMessages { public ValidationMessages(string Message) { this.Message = Message; } public string Message { get; set; } } } </code></pre> <p>VALIDATIONUSERCONTROL XAML:</p> <pre><code>&lt;UserControl x:Class="ValidationWPF.ValidationUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:local="clr-namespace:ValidationWPF.DataSources" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"&gt; &lt;UserControl.Resources&gt; &lt;/UserControl.Resources&gt; &lt;Grid x:Name="LayoutRoot" Background="White"&gt; &lt;telerik:RadTreeView x:Name="radTreeView" Margin="8"&gt; &lt;telerik:RadTreeView.ItemTemplate&gt; &lt;HierarchicalDataTemplate ItemsSource="{Binding SubItems}"&gt; &lt;TextBlock Text="{Binding item}" /&gt; &lt;/HierarchicalDataTemplate&gt; &lt;/telerik:RadTreeView.ItemTemplate&gt; &lt;/telerik:RadTreeView&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>OUTPUT:</p> <pre><code>Customer Name Message Below* *System.Collections.ObjectModel.ObservableCollection'1[ValidationWPF.DataSources.ValidationMessages] </code></pre>
    singulars
    1. This table or related slice is empty.
    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