Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I fix the 'Specified class name 'WpfSample.MainWindow' doesn't match actual root instance type 'System.Windows.Window' error?
    primarykey
    data
    text
    <p>So I am trying to use a custom wpf control on a winforms using:</p> <pre><code>var f = new FileStream (@"C:\sample.xaml", FileMode.Open, FileAccess.Read); var element = XamlReader.Load(f); f.Close(); var elementHost = new ElementHost(); elementHost.Dock = System.Windows.Forms.DockStyle.Fill; elementHost.Child = element; this.Controls.Add(elementHost); </code></pre> <p>I am not experienced in WPF so I don't know how to fix this error.</p> <p>EDIT:</p> <p>So this is the xaml file:</p> <pre><code>&lt;Window x:Class="WpfSample.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:r="http://schemas.aspitalia.com/Ricciolo/Controls" Title="MainWindow" Height="350" Width="525"&gt; &lt;Grid&gt; &lt;Grid.Resources&gt; &lt;XmlDataProvider x:Key="data" Source="Data.xml"&gt; &lt;/XmlDataProvider&gt; &lt;HierarchicalDataTemplate x:Key="dt" ItemsSource="{Binding XPath=outline}"&gt; &lt;/HierarchicalDataTemplate&gt; &lt;/Grid.Resources&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;r:TreeListView ItemsSource="{Binding Source={StaticResource data},XPath=/opml/body/outline/outline}" ItemTemplate="{StaticResource dt}"&gt; &lt;r:TreeListView.Columns&gt; &lt;GridViewColumn Header="Title" DisplayMemberBinding="{Binding XPath=@title}" Width="150" /&gt; &lt;GridViewColumn Header="Childs" DisplayMemberBinding="{Binding XPath=@count}" Width="100" /&gt; &lt;GridViewColumn Header="Url" DisplayMemberBinding="{Binding XPath=@xmlUrl}" Width="200" /&gt; &lt;/r:TreeListView.Columns&gt; &lt;/r:TreeListView&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p>I also got this from a free custom treelistview control on the net, and included both the compiled control and the data.xml in the solution, this xaml uses.</p> <p>EDIT2:</p> <p>Code behind for MainWindow.xaml:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfSample { /// &lt;summary&gt; /// Interaction logic for MainWindow.xaml /// &lt;/summary&gt; public partial class MainWindow : Window { public MainWindow ( ) { InitializeComponent ( ); } } } </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.
 

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