Blogs

The One With

Silverlight Data Editors and Mask Edits in 9.2

     

The 9.2 release introduces a lot of new controls and features to our Silverlight suite. In this release we are formally introducing the concept of editors, both as standalone and as embeddable. A lot of work has been done to merge our exiting in-place edits from the AgDataGrid and our editors from WPF to create a sound framework from which we can derive things like TextEdits, DateEdits, ComboBoxes etc.

BaseEdit

An abstract control from which all other editors derive. BaseEdit provides

    • the basic look and feel
    • an abstraction for Display and Edit templates (recall the ColumnType templates in the AgDataGrid, but now at a much lower level)
    • support for *validation* and an ErrorPresenter

* BaseEdit cannot will be used directly. Use it only to create a custom and specialized editors.

CheckEdit

image 

<dxe:CheckEdit></dxe:CheckEdit>

DateEdit

image

<dxe:DateEdit></dxe:DateEdit>

ComboEdit

image 

<dxe:ComboBoxEdit>

    <dxe:ComboBoxEdit.Items>

        <sys:String>Item 1</sys:String>

        <sys:String>Item 2</sys:String>

        <sys:String>Item 3</sys:String>

        <sys:String>Item 4</sys:String>

        <sys:String>Item 5</sys:String>

    </dxe:ComboBoxEdit.Items>           

</dxe:ComboBoxEdit>

 

ButtonEdit

image

<dxe:ButtonEdit></dxe:ButtonEdit>

<dxe:ButtonEdit>

    <dxe:ButtonEdit.Buttons>

        <dxe:ButtonInfo GlyphKind="Regular" IsLeft="True"/>

    </dxe:ButtonEdit.Buttons>

</dxe:ButtonEdit>

TextEdit

image 

<dxe:TextEdit></dxe:TextEdit>

<dxe:TextEdit>

    <dxe:TextEdit.Mask>

        <dxe:MaskProperties MaskType="DateTime"/>

    </dxe:TextEdit.Mask>

</dxe:TextEdit>

 

<dxe:TextEdit>

    <dxe:TextEdit.Mask>

        <dxe:MaskProperties MaskType="Simple" EditMask="(999)000-0000"/>

    </dxe:TextEdit.Mask>

</dxe:TextEdit>

TextEdit and it’s descendants (All ButtonEdit, ComboEdit etc..) supports Masking. For for editing and displaying purposes. Supported masks range from the very simple

DateTime and Numeric to the very complex powered by a Regular Expression of your choosing.

Simple Masks
image 

<dxe:MaskProperties MaskType="Simple" EditMask="(999)000-00-00"/> // US Phone Number

<dxe:MaskProperties MaskType="Simple" EditMask="99/99/00"/> // Short Date

<dxe:MaskProperties MaskType="Simple" EditMask="90:00:00 &gt;LL"/> // Long Time

<dxe:MaskProperties MaskType="Simple" EditMask="90:00"/> // Short Time

<dxe:MaskProperties MaskType="Simple" EditMask="999"/> // 3 Digit Phone Ext.

<dxe:MaskProperties MaskType="Simple" EditMask="000-00-0000"/> // Social Security Number

<dxe:MaskProperties MaskType="Simple" EditMask="00000-9999"/> // Long Zip Code

<dxe:MaskProperties MaskType="Simple" EditMask="00000"/> // Short Zip Code

Numeric Masks

image

<dxe:MaskProperties MaskType="Numeric" EditMask="c"/> // Currency

<dxe:MaskProperties MaskType="Numeric" EditMask="#,##0.00;&lt;&lt;#,##0.00&gt;&gt;"/> // Negative Number

<dxe:MaskProperties MaskType="Numeric" EditMask="n"/> // Number

<dxe:MaskProperties MaskType="Numeric" EditMask="d8"/> // 8 digits

<dxe:MaskProperties MaskType="Numeric" EditMask="p"/> // Percent (with decimals)

<dxe:MaskProperties MaskType="Numeric" EditMask="P"/> // Percent

Date and Time Masks
image 

<dxe:MaskProperties MaskType="DateTime" EditMask="f"/> // Full

<dxe:MaskProperties MaskType="DateTime" EditMask="MM/dd/yyyy h:m:s t"/> // Custom

<dxe:MaskProperties MaskType="DateTime" EditMask="R"/> // RFC 1123

<dxe:MaskProperties MaskType="DateTime" EditMask="u"/> // Universal

<dxe:MaskProperties MaskType="DateTime" EditMask="M"/>  // Month and Day

<dxe:MaskProperties MaskType="DateTime" EditMask="Year: yyyy"/> // Year

<dxe:MaskProperties MaskType="DateTime" EditMask="t"/> // Time Only

<dxe:MaskProperties MaskType="DateTime" EditMask="d, dddd"/> // Day and Day of the Week

Regular Masks
image 

<dxe:MaskProperties MaskType="Regular" EditMask="(\d?\d?\d?)\d\d\d-\d\d-\d\d"/> // Phone Number

<dxe:MaskProperties MaskType="Regular" EditMask="\d?\d?/\d\d/\d\d"/> // Short Date

<dxe:MaskProperties MaskType="Regular" EditMask="\d?\d:\d\d:\d\d >[PA]M"/> // Long Time

<dxe:MaskProperties MaskType="Regular" EditMask="\d?\d:\d\d"/> // Short Time

RegEx Masks
image

<dxe:MaskProperties MaskType="RegEx" EditMask="((10|11|12|[1-9]):[0-5]\d:[0-5]\d(am|pm))|((2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9])"> // Time

<dxe:MaskProperties MaskType="RegEx" EditMask="((\+\d|8)?\(\d{3}\))?\d{3}-\d\d-\d\d"/> // Phone Number

<dxe:MaskProperties MaskType="RegEx" EditMask="([1-9]|10|11|12)/(0?[1-9]|[12]\d|30|31)/\d{2}\d{2}?"> // Short Date

<dxe:MaskProperties MaskType="RegEx" EditMask="([01]?[0-9]|2[0-3]):[0-5]\d"/> // Short Time

<dxe:MaskProperties MaskType="RegEx" EditMask="\d{3}-\d{2}-\d{4}"/> // Social Security

TextEdit and AgDataGrid

image

 

<dxg:AgDataGrid>

    <dxg:AgDataGrid.Columns>

        <dxg:AgDataGridColumn FieldName="CellPhone">

            <dxg:AgDataGridColumn.EditSettings>

                <dxes:TextEditSettings>

                    <dxes:TextEditSettings.Mask>

                        <dxe:MaskProperties MaskType="Simple" EditMask="(999)000-00-00"/>

                    </dxes:TextEditSettings.Mask>

                </dxes:TextEditSettings>

            </dxg:AgDataGridColumn.EditSettings>

        </dxg:AgDataGridColumn>

    </dxg:AgDataGrid.Columns>

</dxg:AgDataGrid>

Cheers,

Azret

Published Jul 15 2009, 05:54 PM by Azret Botash (DevExpress)
Bookmark and Share

Comments

 

ccchai said:

Is the ComboBoxEdit has ValueMemberPath? Or is it as difficult to use as the combo box in Silverlight SDK?

July 15, 2009 10:00 PM
 

Peter Thorpe said:

I'm now seriously thinking about changing a project I was going to be working on in a couple of months from asp.net to Silverlight.

I think it's something a lot of developers want to get into but it's yet another thing to learn, at least with some good user controls it allows us to create something decent even when still learning.

Can't wait for all the new features of volume 2 been checking the website every day for the beta.

July 16, 2009 4:52 AM
 

Morten Bergman said:

That's great news, Azret. Thank you! We have been waiting for this feature. Will AgDatagrid Pro v9.2 be out of beta stage?

July 16, 2009 9:18 AM
 

Deepak Mehta said:

Can we expect XAF in Silverlight... Now that we have the basic controls (almost) for XAF support.

July 16, 2009 11:43 AM
 

Ben Hayat said:

Azret, can these mask settings be done visually in Blend3, where we can pick the desired mask from a drop down box and assign it to a control? Or do we to drop down to manual XAML code to do so?

Thanks!

July 16, 2009 10:42 PM
 

Azret Botash (DevExpress) said:

@ccchai: We have both DisplayMember and ValueMember.

July 17, 2009 2:12 PM
 

Azret Botash (DevExpress) said:

@Deepak: Not just yet :)... but trust me all want one (XAF.SL)

July 17, 2009 2:14 PM
 

Azret Botash (DevExpress) said:

@Ben... It's good idea, thank you.. but right you have to set them in XAML.

July 17, 2009 2:16 PM
 

Azret Botash (DevExpress) said:

@Morten: We are trying to get it out as RT ASAP...

July 17, 2009 2:17 PM
 

ctodx said:

We're just about to release v2009.2 and it would be a good idea to have an "accumulator"

August 20, 2009 8:29 PM
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.