Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:40:23+00:00 2026-06-18T12:40:23+00:00

I have a CustomControl derived class in a dll ( MyNamespace.UI ). How can

  • 0

I have a CustomControl derived class in a dll (MyNamespace.UI). How can I use this control in my main application? I’ve tried adding a reference to the project and then using a custom XAML namespace to point to my namespace, but it can’t find it:

<Page ...
    xmlns:ui="using:MyNamespace.UI"
    ...>
<Canvas>
    <ui:MyControl />
</Canvas>
</Page>

I get an error:

The name “MyControl” does not exist in the namespace “using:MyNamespace.UI”.

Searching around, I managed to find the following quote:

The name of the assembly that defines the backing types for a XAML
namespace is not specified in the mapping. The logic for which
assemblies are available is controlled at the app-definition level and
is part of basic app deployment and security principles. Declare any
assembly that you want included as a code-definition source for XAML
as a dependent assembly in project settings.

http://msdn.microsoft.com/en-gb/library/windows/apps/jj150588.aspx

Can someone point me in the direction of the “dependent assembly” setting in the project settings?

Edit After making sure the root namespace project setting matched the namespace of my control (MyNamespace.UI) I could get the project to compile. But I can’t get it to run because I get loads of crashes with the following information:

WinRT information: Cannot create instance of type ‘MyNamespace.UI.MyControl’ [Line: 44 Position: 37]

No information on why it couldn’t make the control though… I stepped through the constructor of MyControl and the exception is thrown in InitializeComponent(). This is the XAML of my UserControl (MyControl):

<UserControl
    x:Class="MyNamespace.UI.MyControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">

    <Grid>

    </Grid>
</UserControl>

Edit 2 I deleted the Grid control, built and ran, and it worked, so then I put the Grid control back, and it still worked. Very weird.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:40:24+00:00Added an answer on June 18, 2026 at 12:40 pm

    You need to make sure the MyNamespace.UI assembly has a RootNamespace property that matches MyNamespace.UI. This property can’t be changed in the project settings pages, but you can do it via notepad or equivalent. My RootNamespace was set to UI, and when I changed it, it started working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom control derived from Button: class MyControl : Button{} And suppose,
I have a class derived from slider which uses a custom control template and
I have a pop-up CustomControl which I use in a large-scale web application. The
I have a custom control that is derived from ListView . This list view
I have a custom control that i have derived from the Control class. I
I have defined following control template for my custom control. <ControlTemplate TargetType={x:Type local:CustomControl}> <Grid
I have a custom control that inherits from UserControl , and I can't get
I have my own control derived from Windows.Forms.Control and I am checking the Parent.BackColor
I have created a custom control which derives from Panel. I use it to
i have created a custom user control which im using on my main xaml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.