We had a requirement to use xammaskededitor inside a xamgrid . For this I added a customcolumn which has a displaycontrol as a textblock and the editor control as the Xammaskededitor control.
For some reason in edit mode , when the user empties the values for eg : no value , which is equivalent to "__/__/__" according to my mask the under lying View model is not getting updated properyly. If i change it a valid value I can see the view model getting updated and the cell gets updated to the new value.But the problem comes when the user wants to have an empty date value, the cell is retaining the old value because the view model newver gets updated in those scenarios?
I followed the apporach here to add the custom column to the grid.
http://blogs.infragistics.com/blogs/devin_rader/archive/2010/07/08/creating-custom-columns-for-xamgrid.aspx
To Reproduce:
1.Create a xamgrid.bind it to a view model
2. Add a customcolumn to the grid which has TextBlock as the displaycontrol and the XamMaskEditor as the editor control.Bind it two way to the view model.
3. When the user empties the text, the view model is not updated and the cell retains the old value.When the value is set to a valid value it behaves properly.
(I also noticed that when the XamEditor is used as regular control on the form it behaves properly)
As discussed the snippet in the XamMaskedEditor lost focus inside the CustomeDateColumnProvider class ;
.Empty;
;
)
{
.DEFAULT_TXT.Trim()))
dateValue;
dateValue))
((
)sender).Focus();
It sounds as if you have worked around the issue, but are unable to get the ideal behavior. If you would like me to research this further, please review the attached sample, which is a slight modification of the previous one I provided to make it a little closer to the application you described. (i.e. I merely added a stand-alone dropdown and wired up the LostFocus event.)
If you can either modify this sample, or guide me on how to do so such that it models your current situation....or supply a new sample of your own, I will be sure to investigate further.
Thanks,
u are right ..if u use the XamMaskededitor in the Always mode, then it will stay focus. There also we had found an issue..If the editors value is an invalid date and the user tries to focus on a Dropdownbox some where on the screen and selects a value it still looses focus..Which is Ok..Problem is one of our drop down is allowing the user to put the grid in a read only mode..
When there is a erros in the date editor and the user goes to this drop down and puts the grid in read only mode(none of the cells in the grid is edtable) and comes back to edit mode by selecting the edit option from the drop down..the grid never becomes editable...(the problem I believe is the date picker which was in the edit mode with its focus still on on it) ....We some how solved by using the value changed event and keeping the focus on the cell...
Ideally we wanted to use the LostFocus mode of the control and not the Always mode for 2 reason ..,
1. To only show the error message when the user looses focus as against showing the error message always till the data is corrected
2. Also we wanted to keep the focus on the cell, if the data is bad
I might not be clear on your requirements. The sample I attached does not have the LostFocus event wired up, nor does it need to. If you provide an invalid date, the focus is not lost, but it remains in the cell's editor, as expected. Is there a reason why you need to use LostFocus?
the lost focus issue is still not solved.when the XamMaskedEditor has an invalid date and if we try to handle the that in the lost focus its not working..
this is the lost focus event in the CustomDateColumnProvider.
e)