Reputation: 2416
I'm databinding and formatting a TextEdit control like so:
txtArea.DataBindings.Add("EditValue", _ProductItem, "Area", true, DataSourceUpdateMode.OnPropertyChanged);
txtArea.Properties.Mask.EditMask = @"\d*\.{0,1}\d{1,3}";
And in the properties for this TextEdit textbox, I've set Properties -> Mask -> MaskType to RegEx. And also, Properties -> DisplayFormat -> FormatType is Numeric and the FormatString is set to n3.
If the databound EditValue is set to 24.12345 then that's what is displayed in the textbox when I run the app. But, I'm expecting to just see 24.123. And when I click in the textbox, the value displayed is then changed to 24.123 correctly. But when I exit the textbox (without making any changes), it's set back to the original EditValue of 24.12345.
If I hardcode the EditValue like txtArea.EditValue = 24.12345 the initial display is 24.123 as expected. And while in edit mode, it's 24.123 as expected.
It's like DataBinding is ignoring the DisplayFormat property altogether. Does anyone have any experience with this using DevExpress controls?
Upvotes: 1
Views: 2252
Reputation: 649
memoEdit.DataBindings.Add("Text", DataSource, "DataMember", false, DataSourceUpdateMode.OnPropertyChanged);
//or
memoEdit.DataBindings.Add("EditValue", DataSource, "DataMember", false, DataSourceUpdateMode.OnPropertyChanged);
Upvotes: 0
Reputation: 2416
Here's the fix:
Set txtArea.Properties.Mask.UseMaskAsDisplayFormat to true.
This worked although I did try it before while playing with all of the various formatting options.
Upvotes: 4