Click here to Skip to main content

hzawary asked:

Open original thread
Hi sir
 
Ok, I want loading any UserContols as DLL on a MainWindow project as host by selecting them in runtime.
I tried this article SelfContainedAssembly[^] and I converted it to a WPF project that you can see MyProject[^], also test it with StackPanel and etc succesfully, but I want develope a WPF UserControl project like this
<usercontrol x:class="ManyWpfControlLibrary.UserControl1" xmlns:x="#unknown">
             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" 
             mc:Ignorable="d" 
             d:DesignHeight="150" d:DesignWidth="300">
    <grid removed="#FFFA8383">
 
    </grid>
</usercontrol>
 
with code-behind
namespace ManyWpfControlLibrary
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }
}
 
This UserControl compiled to a DLL file, finally it would insert into my MainWindow project at runtime, but I couldn't to do this.
 
In fact, we haven't aware about the DLL (UserControl compiled), it created and developed offline by another persons and there is on a different assembly, only we load and insert it on the main project at runtime!
 
Help me about this method or another idea. If the issue is ambiguous and you got the idea, please you edit this post to more understanding.
 
Thanks in advance.
Tags: C#, .NET, XAML, WPF, UI

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.140718.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid