For instance if the value from my database is 04/01/1997 then my xamEditor shows 04/0001
If I change the mask to yyyy/mm then it shows 0004/01
However, if I change my Property (shown below) to a type of string and convert the text manually by building a string from the date it works correctly. Can someone explain why this isn't working?
Here is what my XAML looks like
<igEditors:XamDateTimeEditor Mask="mm/yyyy" Text="{Binding Path=member.init_dt, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True}" >
Here is what my Code Behind looks like
Public Property init_dt As Nullable(Of Date)
Get
If currentRecord Is Nothing Then
Return Nothing
Else
If IsDBNull(currentRecord("init_dt")) = False Then
Dim odte As Date = currentRecord("init_dt")
Return odte
End If
End Get
Set(ByVal x As Nullable(Of Date))
Dim dte As Object
If x IsNot Nothing Then
dte = x
dte = DBNull.Value
If Not currentRecord Is Nothing Then
currentRecord("init_dt") = dte
End Set
End Property
Thank you very much for your time and explanation. I was just not accustomed to a value property on a textbox. This makes much more sense.
In general you normally want to bind the Value property of the Editor to your actual property. When you bind the Text property all the control gets is a string value and then it has to try and interpret that as the type it is to be editing - in this case a datetime. The way that the xamMaskedEditor works is that when the Text is set it tries to apply that text to the mask characters. That is why when you reversed the mask the 4 and 1 were still applied to the first and second sections respectively. So if you bind to the Value property the control has more information (in this case it has the entire date) and can use that information accordingly (e.g. get the month from it and use that in the month section, etc.).
Should all of my bindings be on value instead of text for xam editors? (When I want to edit the text's value?)
I just noticed that you are binding the Text property which is of type string. Can you try binding the Value property?
I also have a demo version of 10.3. Are they allowed to be installed together?