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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:48:15+00:00 2026-05-22T02:48:15+00:00

I am trying to allow several classes to inherit a more general Silverlight user

  • 0

I am trying to allow several classes to inherit a more general Silverlight user control to avoid redundancy in my code. The classes inherit the extended control, which then inherits the User Control class. The issue I have been running into is that the ExtendedControlExtension.g.cs file regenerates every time I compile, with the incorrect inheritance (it inherits User Control not my Extended Control).

Note that I have been inheriting the Extended Control in the .cs and g.cs files, but continuing to use the User Control tag in the .aspx file as this causes the error

Error 29 The tag ‘ExtendedControl’ does not exist in XML namespace ‘http://schemas.microsoft.com/winfx/2006/xaml/presentation’.

Is there a way to fix this?

Thanks!

  • 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-22T02:48:16+00:00Added an answer on May 22, 2026 at 2:48 am

    You cannot change the .g.cs file, in fact is says so right in the file. Also, it’s unfortunate to use the term “custom control” as this means something specific and not what you are trying to do. But, the good news is that what you are trying to do is possible.

    Derive from UserControl:

    public class FancyUserControl : UserControl
    {
        // Your added common functionality.
    }
    

    and then add a new UserControl to your project using the normal mechanism, let’s say UserControl1. Then edit the UserControl.xaml files as follows:

    <local:FancyUserControl x:Class="SilverlightApplication1.UserControl1"
        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"
        xmlns:local="clr-namespace:SilverlightApplication1"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
    
        <Grid x:Name="LayoutRoot" Background="White">
    
        </Grid>
    </local:FancyUserControl>
    

    paying special attention to the three lines with local in them, adjusting to your application. Then edit the UserControl1.xaml.cs file as follows:

    public partial class UserControl1 : FancyUserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }
    

    and Visual Studio won’t be quite happy yet but finally rebuild your project and all will be well.

    The class UserControl1 is now derived from FancyUserControl instead of UserControl and you can begin adding your common functionality. To add more controls you will need to manually edit the XAML and code-behind once after initially adding each new control to the project.

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

Sidebar

Related Questions

I'm trying to configure Apache to allow read only access and ask for user
I'm trying to create a function in C# which will allow me to, when
I am trying to find out which Hypervisor will allow me to grant access
I'm working on a forums system. I'm trying to allow users to see the
I am trying to progamrtaiclly allow write access to ASPNET account on a directory.
I'm trying to write a script to allow me to log in to a
I've been trying to figure out a regex to allow me to search for
I'm trying to create a basic system that will allow only specific users to
I'm trying to create a Regex usuable in C# that will allow me to
I am trying to create a sidebar for a site that will allow a

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.