We have two date controls as From and To and have validation of each date, if validation fails user should stay on the same field. Also we want date control to appear with date mask ( / / ) and dropdown icon.
I was able to do this with following settings and validation code with setting focus (not given here)
<igEditors:XamDateTimeEditor DropDownButtonDisplayMode="Always"
DisplayMode="IncludeBoth" IsAlwaysInEditMode="True"/>
Issues that we are having now as below,
1. We used IsAlwaysInEditMode="True" to make the mask appear to the user without actually start entering the date. But this is causing date value not being notified to view model. This may be because IsAlwaysInEditMode="True" means EditModeStarted and EditModeEnded will be ignored with this setting.
2. We used DropDownButtonDisplayMode="Always" to show the dropdown to the user without actually mouse over on the date control. This is causing user to leave the one date control with the business errored date to the other when user click the dropdown icon of the other date control.
Please guide us in the right direction, Thanks
I am very sorry for the delay. It worked fine when the converter was set, it display the blank and the format before the control gets focus.
Issue now is once date is selected it gets binded to a property in my ViewModel. When I clear the value on clicking a button by setting date property to nothing. The value appears to be on the date, but when i click the control it disappear and again the date appears after lossing the focus.
Now did not had time to debug this issue, I will update after this week end. Thanks
I am sorry, I was on leave for 2 days, I will get back to you today
Hi
Is this issue resolved ? Do you have any further questions regarding this ?
In additon to what Andrew has said.
If in case you are using EditModeStarted/Ended for updating the view model, then you have two options:
* You can use some other mechanism other than EditModeStarted/Ended events, like focus change (for this you can bind to IsFocusWithin property of the ValueEditor to know when the user leaves the focus), to handle updating of the view model.
* Leave the IsAlwaysInEditMode set to false and instead specify a ValueToDisplayTextConverter that will show the prompt characters when not in edit mode. Here’s the code for ValueToDisplayTextConverter:
public class MyMaskDisplayTextConverter : IValueConverter
{
private static IValueConverter g_baseDisplayTextConverter;
static MyMaskDisplayTextConverter( )
XamMaskedEditor tmpEditor = new XamMaskedEditor( );
g_baseDisplayTextConverter = tmpEditor.ValueToDisplayTextConverterResolved;
}
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
object val = g_baseDisplayTextConverter.Convert( value, targetType, parameter, culture );
XamMaskedEditor maskEditor = parameter as XamMaskedEditor;
if ( null != maskEditor )
if ( null == val || val is string && 0 == ( (string)val ).Length )
val = maskEditor.GetText( MaskMode.IncludeBoth );
return val;
public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
return g_baseDisplayTextConverter.ConvertBack( value, targetType, parameter, culture );
Tusky said: 1. We used IsAlwaysInEditMode="True" to make the mask appear to the user without actually start entering the date. But this is causing date value not being notified to view model. This may be because IsAlwaysInEditMode="True" means EditModeStarted and EditModeEnded will be ignored with this setting.
Tusky said: 2. We used DropDownButtonDisplayMode="Always" to show the dropdown to the user without actually mouse over on the date control. This is causing user to leave the one date control with the business errored date to the other when user click the dropdown icon of the other date control.