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

  • Home
  • SEARCH
  • 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 8197595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:46:28+00:00 2026-06-07T05:46:28+00:00

Example XAML to be loaded dynamically <Grid xmlns=’http://schemas.microsoft.com/winfx/2006/xaml/presentation’ xmlns:x=’http://schemas.microsoft.com/winfx/2006/xaml’ xmlns:usercontrols=’clr-namespace:App.Views.UserControls’> <TextBlock>Why don’t you click

  • 0

Example XAML to be loaded dynamically

<Grid xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'     
      xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' 
      xmlns:usercontrols='clr-namespace:App.Views.UserControls'>

         <TextBlock>Why don't you click the button?</TextBlock>

         <usercontrols:SuperButton
         Command="{Binding DataContext.OpenURLNew,RelativeSource=
           {RelativeSource FindAncestor, AncestorType={x:Type ContentPresenter}}"
         CommandParameter="50">

         ClickMe</usercontrols:SuperButton>
</Grid>

Loading this fails with ‘can not load unknown type usercontrols:superbutton’, despite the fact that SuperButton is defined in the same assembly.

I’m guessing this is because SuperButton has associated code-behind? Is there a way to help XamlReader.Load() find what it needs?

  • 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-07T05:46:29+00:00Added an answer on June 7, 2026 at 5:46 am

    What you’re doing should work – try using the fully qualified assembly name in xmlns:usercontrols=''.

    I did this exact thing a while back (perhaps the netGooey library I wrote might be useful for you). netGooey loads XAML dynamically into the page with support for user-defined controls.

    My XAML header looked like this:

    <Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="499" Height="579"
    xmlns:playback="clr-namespace:inlayShared.ui.controls.playback;assembly=inlayShared"
    xmlns:library="clr-namespace:inlayShared.ui.controls.library;assembly=inlayShared">

    Control use like:

    <playback:volumeSlider Maximum="100" Minimum="0" Margin="42,180,62,0" Height="30" VerticalAlignment="Top" TickFrequency="10" TickPlacement="BottomRight" />

    And the dynamic XAML loading like this:

                _gSystem.invokeOnLocalThread((Action)(() =>
                {
                    FileStream fileStream = File.OpenRead(_sUIFile);
                    DependencyObject dependencyObject = XamlReader.Load(fileStream) as DependencyObject;
                    fileStream.Close();
    
                    if (dependencyObject == null)
                        return;
    
                    Content = dependencyObject;
                }), true);`
    

    Perhaps I forgot some key part to getting XAML to notice the custom controls but I’m pretty sure it just ended up working.

    Good luck. (Hopefully the fully qualified change fixes it for you)

    http://inlay.codeplex.com/SourceControl/changeset/view/42822#549758

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

Sidebar

Related Questions

xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation How is this url mapped to .NET namespaces? Can you give an example
I want to understand the example from msdn ( http://msdn.microsoft.com/en-us/library/ms742521.aspx#defining_simple_datatemplate ). XAML Code: <ListBox
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I have been trying to reproduce this example: http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx For some reason my treeview
The labels in the example below (WPF/XAML) just parade off the screen, no wrapping
I want to change the source in XAML to another object source. For example:
Example CSS #wrap{margin:20px} Code prettify wraps the whole line in .com <span class=com>#wrap{margin:20px}</span> Somebody
Anyone know (or can provide) a programming/XAML example with WPF of a image collection
The content of my DataGrid (Product and Price, for example) is loaded from an
I have simplified example: XAML: <CheckBox IsChecked={Binding Path=IsSelected, Mode=TwoWay} Name=cb /> <Button Name=button1 Click=button1_Click

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.