﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » Default properties on designer changed on base change my property</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 00:18:56 GMT</lastBuildDate><ttl>20</ttl><item><title>Default properties on designer changed on base change my property</title><link>http://forum.strataframe.net/FindPost11402.aspx</link><description>I see that If I set a "default" property (example: the "cursor" property of a form set to "default"), the designer don't put code on designer, and the property not are "Bold"&lt;br&gt;
&lt;br&gt;
I like to inherit "control1" with some default property on the base, but that property on base are inherited of some Base2 and If I change the default property of the base2 don't like that this change the base and "control1" property... (that are set to default) I have to change it programmatically? (because if I set it on base to the default value, it not overwrite the base2 property) &lt;br&gt;
&lt;br&gt;
I think that a better question is: ¿can I set a property to a default value without the base can change that?&lt;br&gt;
&lt;br&gt;
[u]more graphically:[/u]&lt;br&gt;
Control1 : Base : Base2&lt;br&gt;
&lt;br&gt;
something like a default property "Color = RED" on base 2&lt;br&gt;
&lt;br&gt;
and I like that control1 and Base have the property "RED" still if base2 change it&lt;br&gt;
&lt;br&gt;
I can do it editing the designer or I have to set any "default" property (to me) on load or something else? thanks!!</description><pubDate>Tue, 11 Sep 2007 13:14:32 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: Default properties on designer changed on base change my property</title><link>http://forum.strataframe.net/FindPost11431.aspx</link><description>[quote]Thanks for the Clear answers that you give to me on every post.[/quote]&lt;/P&gt;&lt;P&gt;Thanks, I wouldn't say I'm always clear, but I try to explain things as much as possible ;)</description><pubDate>Tue, 11 Sep 2007 13:14:32 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Default properties on designer changed on base change my property</title><link>http://forum.strataframe.net/FindPost11410.aspx</link><description>I'm still very Visual FoxPro - Minded and some things like that on .net not are implemented.&lt;br&gt;
In VFP if you select the default property and "set" it on the designer, it will be overwriten. and with the right mouse button you can default it again :/&lt;br&gt;
&lt;br&gt;
I think that it can be done on .Net with hard difficulty coding and some weird and strange logic  :P :crazy:&lt;br&gt;
&lt;br&gt;
Thanks for the Clear answers that you give to me on every post.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;</description><pubDate>Mon, 10 Sep 2007 14:32:02 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: Default properties on designer changed on base change my property</title><link>http://forum.strataframe.net/FindPost11408.aspx</link><description>Aha, here comes the problem with inheriting controls and using the designer.&amp;nbsp; If you set a property in a base class, the designer adds it to the code of the InitializeComponent() method, which gets called by the inherited controls as well.&amp;nbsp; Then, if you set the property back to its default, the subclass designer thinks that it doesn't need to generate code for it, so it does not serialize it (bold it).&amp;nbsp; But, since no code was generated to set it back to the default, the base class's code to set the property takes over.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Kind of a pain if you ask me.&amp;nbsp; The problem is being able to control the ShouldSerializePropertyName and ResetPropertyName methods, which are defined in the class that defines the property.&amp;nbsp; Since the property was defined in the base class, it controls whether the value should be serialized.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Long story short, the only way to fix it is to set the proper value within the subclass, programmatically.&amp;nbsp; If component designers were smart, they would make the ShouldSerializeX and ResetX methods overridable, but I've never seen a control where they were.</description><pubDate>Mon, 10 Sep 2007 13:26:40 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>