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 3284170
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:07:28+00:00 2026-05-17T20:07:28+00:00

I am basically using a user control for the first time, so hopefully it’s

  • 0

I am basically using a user control for the first time, so hopefully it’s just a dumb mistake.

I have a simple user control

<UserControl x:Class="TestProject.WebApp.myUserControl"
    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"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid>
        <sdk:AutoCompleteBox Name="myACB" ItemsSource="{Binding Data}" FilterMode="StartsWith" MinimumPrefixLength="2" >
        </sdk:AutoCompleteBox>
    </Grid>
</UserControl>

I am using the control in another page (in a stack panel):

<navigation:Page x:Class="TestProject.WebApp.myPageView" 
           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"
           xmlns:local="clr-namespace:TestProject.WebApp"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation">
    <Grid>
        <StackPanel Orientation="Horizontal">
            <local:myUserControl x:Name="myUC" />
        </StackPanel>
    </Grid>
</navigation:Page>

The control is in the same namespace as page. Removing the x:Name allows the project to compile and the control functionally works. When x:Name is specified I get an error in the generated code of the page:

Type ‘TestProject.WebApp.myUserControl’ is not defined.

It happens on these lines of code:

internal TestProject.WebApp.myUserControl myUC;

this.myUC == (TestProject.WebApp.myUserControl)this.FindName("myUC")

I tried with two different controls. Same thing. The generated code has “using TestProject.WebApp;” so I don’t know why there is an error only when I have a named instance of the control.

I also cannot seem to use just the Name property. I even tried overloading the NameProperty in the control.

  • 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-05-17T20:07:29+00:00Added an answer on May 17, 2026 at 8:07 pm

    I was able to find a post about this here:

    .g.vb file claims that Type X is not defined, even though it is!

    Apparently, there is an issue when a project has a service reference (in my case I am using RIA services) and the user control resides in an assembly with the same root namespace as the one you are trying to use it in.

    So for me it was,

    TestProject.WebApp

    Then I tried creating a new project for just the control

    TestProject.Controls

    Same problem.

    Then, when I renamed the project and changed the namespace to

    CustomControls

    it worked.

    Hopefully this saves someone else from some frustration and I really hope this problem can be fixed by MS soon.

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

Sidebar

Related Questions

Basically, I have been using both Integer.Parse and CInt in most of my daily
I'm using the GL class from JOGL, which basically contains all OpenGL functions. Now
I have a bit of code that basically reads an XML document using the
So I have a webserver in which user can remotely control an external electronic
I have a piece of hardware with an embedded user control accessed by typing
Basically like using the out keyword. But the problem is with the out keyword,
Basically I am inserting an image using the listviews inserting event, trying to resize
Basically I am trying to retrieve a list of stored procedure parameters using Linq
Basically I want to know how to set center alignment for a cell using
Basically the app writes the contents of a Collection to XML. I'm using XMLStreamWriter

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.