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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:57:45+00:00 2026-05-20T21:57:45+00:00

I want to create a WPF user control exposing a property called InnerCaption. The

  • 0

I want to create a WPF user control exposing a property called InnerCaption. The code is below

XAML code

<UserControl x:Class="myControl.UserControl1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <TextBlock Name="_innerCaption" > Hello</TextBlock>
    </Grid>
</UserControl>

CS code behind

namespace myControl
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        public TextBlock InnerCaption
        {
        get { return (TextBlock)this.GetValue(InnerCaptionProperty); }
        set { this.SetValue(InnerCaptionProperty, value); }
        }
        public static readonly DependencyProperty InnerCaptionProperty = DependencyProperty.Register(
        "InnerCaption", typeof(TextBlock), typeof(UserControl1),new PropertyMetadata(false));
        }
}

The question is: I want users to be able to customize the InnerCaption at design time such as: modifying its color, its font style … But I don’t know how Sigh I tried to use some kinds of Binding. But it’s futile. As I know, Binding only supports for binding to a property, right?
Show me a way pls! 🙁

  • 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-20T21:57:46+00:00Added an answer on May 20, 2026 at 9:57 pm

    There’re a simple solution to my problem above: how about the use of ContentPresenter control? Just a few line of code declaring your property (TextBlock, string, …) and then bind the control to the property. I tried and it works! 😀

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

Sidebar

Related Questions

I am trying to create a custom user control in WPF. I want to
I am trying to create a user control within a WPF application that will
How do I create a WPF user control with a sub-panel that accepts other
I want to create a custom WPF dropdown menu, so I created a User
I've created a WPF UserControl which contains a Button. I now want any consumer
I want to create a ColumnSeries Bar Chart in WPF using C#. I shall
I am working with WPF. I want to create keyboard shortcuts for my WPF
I want create wordpress website into which I want create user management... That means
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I am relatively new to WPF and would like to create a UserControl that

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.