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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:48:49+00:00 2026-06-11T00:48:49+00:00

I have UserControl called EditorView that shows different editors (other user controls) based on

  • 0

I have UserControl called EditorView that shows different “editors” (other user controls) based on its Content.

This is EditorView just to test the binding I replaced the FontEditor with TextBlock:

<UserControl x:Class="TrikeEditor.UserInterface.EditorView" ...>

    <UserControl.Resources>
        <DataTemplate DataType="{x:Type te_texture:Texture}">
            <teuied:TextureEditor TextureName="{Binding Path=Name}"/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type te_font:Font}">
            <!--<teuied:FontEditor/>-->
            <TextBlock Text="{Binding Path=Name}"/>
        </DataTemplate>
    </UserControl.Resources>

    <UserControl.Template>
        <ControlTemplate TargetType="{x:Type UserControl}">
            <ContentPresenter Content="{TemplateBinding Content}" x:Name="EditorPresenter"/>
        </ControlTemplate>
    </UserControl.Template>


</UserControl>

The right template is getting picked based on the EditorView.Content and in the case of TextBlock the binding works as desired but in the case of TextureEditor the TextureName property isn’t.

Here is snippet from the TextureEditor:

public partial class TextureEditor : UserControl
{
    public static readonly DependencyProperty TextureNameProperty = DependencyProperty.Register("TextureName", typeof(string), typeof(TextureEditor));
    public string TextureName
    {
        get { return (string)GetValue(TextureNameProperty); }
        set { SetValue(TextureNameProperty, value); }
    }

    public TextureEditor()
    {
        InitializeComponent();
    }
}

Is there anything special that I have to do since I’m using UserControl? Maybe being different namespace is the problem?

  • 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-11T00:48:51+00:00Added an answer on June 11, 2026 at 12:48 am

    The User Control shouldn’t affect it; the difference is that you’re implementing your own dependency property (rather than using the existing one Text in TextBlock). You have to set the value of the TextureName property in the Dependency Property PropertyChanged handler:

    public static readonly DependencyProperty TextureNameProperty = 
        DependencyProperty.Register("TextureName", typeof(string), typeof(TextureEditor),
    
        // on property changed delegate: (DependencyObject, DependencyPropertyChangedEventArgs)
        new PropertyMetadata((obj, args) => {
    
            // update the target property using the new value
            (obj as TextureEditor).TextureName = args.NewValue as string;
        })
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UserControl that is a base class for other user controls, that
This thing is driving me nuts. I have a UserControl that is called WebUserControl.
I have a UserControl that contains an UpdatePanel which wraps some other controls. The
I have created a UserControl called AutorControl with a method to clear its textbox:
I have a custom user control called ErrorNotificationBox. To place that on my page
I have defined a textbox with x:Name=txtMyTextBox inside UserControl called MyView. I've noticed that
I have created Usercontrol called Attach_Template and I assigned its ID as attachTemplate in
I have a specialized UserControl to play media content called PlayerView . The control
Beware, this is a rather basic question (I think). I have a UserControl, called
I have a really simple user control called SetSpeed: <UserControl x:Class=AGWPFControls.SetSpeed xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml MinHeight=50

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.