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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:09:14+00:00 2026-05-19T02:09:14+00:00

I have been working with attached properties and came up with an interesting theoretical

  • 0

I have been working with attached properties and came up with an interesting theoretical question. I know that if I want to set an attached property through XAML, I use the format:

<control ownerClass.propertyName="some value"/>

My question is, what happens if I derive a class from “ownerClass”. For example, if I define the following class:

class MyGrid : Grid {
}

Tried to set it through XAML as follows

<MyGrid>
    <Button MyGrid.Row = "0">Bla Bla</Button>
</MyGrid>

But the intellisense did not let me. Once I used the proper namespace on the attached property, it worked.

Also, it allowed me to do this:

<MyGrid>
    <Button Grid.Row = "0">Bla Bla</Button>
</MyGrid>

It makes sense, of course, since the Row attached property is a static member of the Grid class and was defined by it. The only problem here is that the users of my new class get to know that it was derived from Grid, and that this specific property was defined by the ancestor. To me it seems like this is implementation details that I would not like to expose to the users of my class.

Is there a way to get WPF to hide the fact that this attached property was actually defined by the superclass?

Thanks,

Kobi

  • 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-19T02:09:14+00:00Added an answer on May 19, 2026 at 2:09 am

    I’m not sure I see the problem. I tried this out and it works. Also, the intellisence was working. What .NET version are you using and what version of VisualStudio? I tried this with .NET 4.0 and VS2010

    <local:MyGrid>
        <local:MyGrid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </local:MyGrid.ColumnDefinitions>
        <Button local:MyGrid.Column="1" Content="Button1"/>
        <Button local:MyGrid.Column="0" Content="Button2"/>
    </local:MyGrid>
    
    public class MyGrid : Grid
    {
        public MyGrid() { }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on the app, that has 3 uipickers. I want to
Have been working on this question for a couple hours and have come close
I have been working with NSArray s and NSMutableArray s that store NSDate objects
I have been working with a iPhone app that I would like to have
Attached is a bowling sheet I have been working on to figure out my
I have been working very hard on several very long views which are attached
Unfortunately I've got a bug that I have been working on for 1 full
I have been working with SQL Server as a Developer a while. One thing
I have been working on a large java application. It is quite parallel, and
I have been working on this app for at least 3-4 months and just

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.