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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:41:33+00:00 2026-05-13T13:41:33+00:00

In WPF it’s possible to set a property of a custom control by either

  • 0

In WPF it’s possible to set a property of a custom control by either an attribute or by an inner property. Like this:

<custom:UserControl1 Text="My text here..."></custom:UserControl1>

Equals:

<custom:UserControl1>
    <custom:UserControl1.Text>
        My text here...
    </custom:UserControl1.Text>
</custom:UserControl1>

In ASP.net the type of custom control property can be defined by the PersistenceMode attribute. At the moment I can only find a way to define a property either as an attribute or as an inner property.

Is there a possible way to set the custom control property like WPF on either way?

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-13T13:41:33+00:00Added an answer on May 13, 2026 at 1:41 pm

    For Text, setting:

    [
    PersistenceMode(PersistenceMode.InnerProperty),
    DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
    ]
    public string Text
    

    For the property you want to appear that way will allow you do to the second option; however, alternatively, you probably also could specify it inline. If that’s the only property that you use as a child element, you can also specify PersistenceMode.InnerDefaultProperty or EncodedInnerDefaultProperty (as it would be the default), that latter of which would encode it.

    Realistically, you can’t do everything like you can in WPF in ASP.NET; it’s just not that fully supported in the designer as that wasn’t it’s intent. But primitive types you can define as an inner property with a content design serialization, and it should allow you to do both options.

    HTH.

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

Sidebar

Related Questions

wpf how to do prev next page. Control can be used? Like this prev
WPF application, uses a Window dialog to enter PIN. Normally, it looks like this:
Why WPF DataGrid control doesn't shows defined DisplayNameAttribute values for grid columns? However this
In WPF, I am creating a simple custom control for my TODO program. It
WPF ListBoxItem how to wrap text in it? My Item container style looks like
WPF Toolkit, How to apply date format in C# for datepicker control?
WPF Experts - I am trying to add buttons below my custom listbox and
In WPF textbox, is it possible to get Editing Started and Editing Completed event?
Is WPF yet another GUI toolkit like WinForms with some enhanced features? What other
Simple WPF/XAML question. In XAML, how do I reference the Self/this object in 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.