﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Subclassed Devexpress TextEdit not displaying correctly</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 24 Jun 2026 03:32:27 GMT</lastBuildDate><ttl>20</ttl><item><title>Subclassed Devexpress TextEdit not displaying correctly</title><link>http://forum.strataframe.net/FindPost30614.aspx</link><description>I have a Subclassed Devexpress TextEdit control, where I want a Numeric Field, displaying 2 decimal points. This&amp;nbsp;does not show the decimal points mask, unless I Click into the control. If the value has zero init , it displays as 0&amp;nbsp; (Not 0.00). The minute I click into it , or Edit it, it displays correctly. I have tried the same thing with the Devex Control itself dropped on the form, and manually set the Properties (For which I have Code in the Subclass) , and it works fine.&lt;br/&gt;&lt;br/&gt;Also, if I set the properties manually on the form in my subclassed control, it also shows the 2 decimals&lt;br/&gt;&lt;br/&gt;My subclass code is as follows:&lt;br/&gt;&lt;br/&gt;&lt;font color=#0000ff size=2 face=Consolas&gt;&lt;font color=#0000ff size=2 face=Consolas&gt;&lt;font color=#0000ff size=2 face=Consolas&gt;[quote]public class dxTextEdit2D : dxTextEdit&lt;br/&gt;{&lt;br/&gt;protected override void OnEnter(EventArgs e)&lt;br/&gt;{&lt;br/&gt;base.OnEnter(e);&lt;br/&gt;this.Properties.Mask.UseMaskAsDisplayFormat = true;&lt;br/&gt;this.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;&lt;br/&gt;this.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;&lt;br/&gt;this.Properties.EditFormat.FormatString = "###,####,###,##0.00";&lt;br/&gt;this.Properties.DisplayFormat.FormatString = "###,####,###,##0.00";&lt;br/&gt;this.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;&lt;br/&gt;this.Properties.Mask.EditMask = "n02";&lt;br/&gt;}&lt;br/&gt;} // End dxTextEditN2[/quote]&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;font color=#008000 size=2 face=Consolas&gt;&lt;font color=#008000 size=2 face=Consolas&gt;&lt;font color=#008000 size=2 face=Consolas&gt;I have also attached a screen shot of whats happening&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;font color=#008000 size=2 face=Consolas&gt;&lt;font color=#008000 size=2 face=Consolas&gt;&lt;font color=#008000 size=2 face=Consolas&gt;&amp;nbsp;&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;</description><pubDate>Sat, 19 Nov 2011 08:02:05 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Subclassed Devexpress TextEdit not displaying correctly</title><link>http://forum.strataframe.net/FindPost30640.aspx</link><description>Trent, Edhy, thanks for replying.&lt;br/&gt;&lt;br/&gt;I think the n02 is ok as it was working when I set focus&amp;nbsp;on the control. I got a reply back from Devexpress who pointed me in the right direction , similar to Edhy's suggestion &amp;nbsp;as to where to put the Event code, so am now also over-riding the InitializeDefaultProperties event, and its working fine now.&lt;br/&gt;&lt;br/&gt;[quote]The Control.Enter event occurs when the control becomes focused. If you wish to use the mask by default, I suggest you override the InitializeDefaultProperties method:&lt;br/&gt;protected override void InitializeDefaultProperties()&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; base.InitializeDefaultProperties();&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Properties.Mask.UseMaskAsDisplayFormat = true;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Properties.Mask.EditMask = "n02";&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } [/quote]&lt;br/&gt;&lt;br/&gt;&amp;nbsp;</description><pubDate>Sat, 19 Nov 2011 08:02:05 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Subclassed Devexpress TextEdit not displaying correctly</title><link>http://forum.strataframe.net/FindPost30629.aspx</link><description>That would be my first reaction as well.&amp;nbsp; Masking is fairly consistent in .NET.&amp;nbsp; There are a number of help topics in the standard .NET help about masking and formatting.&amp;nbsp; 3rd party controls generally stick to these standards for the most part.&amp;nbsp; If you look through this article, &lt;a href="http://msdn.microsoft.com/en-us/library/26etazsy.aspx"&gt;string.Format&lt;/a&gt;, you will find a lot of link that take you to data type specific formats that will give you a ton of information on the standard formats.&amp;nbsp; These formats, like Edhy mentions (n2) will ring true.&amp;nbsp; &lt;br/&gt;&lt;br/&gt;There are other options too for optional values, like "0,0.0##". In this format, comma separators will be used and at least 1 decimal place will be forced.&amp;nbsp; But up to 3 decimal placed will be allowed.&amp;nbsp; So I would recommend researching some of this as there is a treasure trove of information if you dig deep enough.</description><pubDate>Fri, 18 Nov 2011 09:46:37 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Subclassed Devexpress TextEdit not displaying correctly</title><link>http://forum.strataframe.net/FindPost30615.aspx</link><description>Hi Ger,&lt;br/&gt;&lt;br/&gt;[quote][b]Ger Cannoll (11/17/2011)[/b][hr]&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;this.Properties.Mask.EditMask = &lt;span style="font-weight: bold;"&gt;"n02"&lt;/span&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;[/quote]&lt;br/&gt;&lt;br/&gt;I believe that the EditMask should be &lt;span style="font-weight: bold;"&gt;"n2" &lt;/span&gt;Also, use the New() constructor instead of the OnEnter.&lt;span style="font-weight: bold;"&gt;&lt;br/&gt;&lt;/span&gt;</description><pubDate>Thu, 17 Nov 2011 16:37:02 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>