Properties of an interface implemented in abstract class.

Feb 16, 2010 at 9:28 PM
Edited Feb 16, 2010 at 9:50 PM

Michael,

I did give it a try. But it still does not work. Here is what I have.

public abstract class ThingBase : IThing1, IThing2 
{
        private type _property1;
        private Independent _indProperty1 = new Independent();
        private type _property2;
        private Independent _indProperty2 = new Independent(); public type IThing2.Property1{} // implements Property1 of IThing2 { get { _indProperty1.OnGet(); return _property1;} set { _indProperty1.OnSet(); _property1 = value;} }
        public type Property2{} // new property in this Base class
        {
              get { _indProperty2.OnGet(); return _property2;}
              set { _indProperty2.OnSet(); _property2 = value;}
         } } public class Thing : ThingBase { // some other properties local to Thing } in XAML I bind to an instance of Thing to Property1, which it inherits from ThingBase and it doesn't work.
If I bind to Property2 of Thing it works, as well as any other non-inherited properties implemented in Thing.
Again this is NOT urgent. 
I was binding to only one such property and later I removed Interface declaration from the base class, in order for binding to work.
Thank you, 
Ivan. 
[EDIT:]
I think it has to do with the use of Property named "Error" when I change it to something else it works. 
Coordinator
Feb 16, 2010 at 11:20 PM

Ah. I think I see the problem. I'm probably reflecting only over properties of the type itself, not inherited properties. This should be a simple fix.

 

Feb 16, 2010 at 11:26 PM
Edited Feb 16, 2010 at 11:26 PM

I think you are reflecting inherited properties of the base type correctly, because Property2 works.
But back to my [Edit:] section...

If property in ThingBase is named "Error", then I can't bind to it, even when it does not implement any interface, and I think it is not UpdateControls issues, there is something with the binding engine itself, because I was not able to get the value out of that property even when control was invalidated.

 

Coordinator
Feb 16, 2010 at 11:45 PM

Interesting. Yes, I confirmed that I am pulling in inherited properties. I'll see what I can find out about the "Error" property.