Hello,
I am using a XamDateTimeEditor inside a XamDatagrid to enter time. During the entry - after pressing the first number - I get multiple System.FormatException
Is there a way to prevent this exception to happen?
Thanks
Niko
XAML looks like this. The EventHandler AutoCompleteMinute is called on editending and does not recieve invalide time (e.g. 1 of 12:00)
<Style TargetType="{x:Type igEditors:XamDateTimeEditor}" x:Key="Uhrzeit"> <Setter Property="Mask" Value="{}{time}" /> <Setter Property="Format" Value="HH:mm" /> <Setter Property="PromptChar" Value="" /> <EventSetter Event="EditModeEnding" Handler="AutoCompleteMinute" /> </Style>
<igDP:UnboundField Label="Startzeit" Name="Startzeit" BindingPath="Startzeit" BindingMode="TwoWay" Visibility="Collapsed"> <igDP:UnboundField.Settings> <igDP:FieldSettings Width="50" EditorType="{x:Type igEditors:XamDateTimeEditor}" LabelClickAction="Nothing"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamDateTimeEditor}" BasedOn="{StaticResource Uhrzeit}"/> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField>
Hello Niko,
I have been investigating into the behavior you are seeing, and I have put together a sample project based on the sample code you have provided, both with a bound Field and an UnboundField as I wanted to ensure that this wasn’t specifically an UnboundField issue. In doing so though, I am unable to reproduce the behavior you are seeing.
I am attaching the sample project I used to test this. Please test this project on your PC, as whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using version 20.1.20201.26 in Infragistics for WPF 2020 Volume 1.
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Please let me know if you have any other questions or concerns on this matter.
XamDataGridDateTimeEditorTest.zip
Hello Andrew,
the example shows a consitent behaviour: I start typing (eg. 0 for 08:00) and I get the exeception.
Please look at the attached screenshot:
I have use the very same version 20.1.20201.26 as well.
I understand that 0 is not a valid time format. The question is what can I do to prevent these exceptions. (Considering that exceptions are expensive and I don't want them in production).
It’s interesting that you are able to reproduce this behavior with the sample project, as I am not able to, and I am attaching a screenshot as proof.
Being that we are using the same specific version of the assemblies, I imagine this could be more related to an environmental issue or perhaps a culture setting. Can you please provide some information on the environment that you are testing in with regards to system culture, OS, .NET Framework targeted, etc?
its a Windows 10 notebook with Austrian country settings: de-AT. I am working with .net 4.8. I changed the culture to US, but get the same exception.
Is the mask relevant for that?
Even after changing my system culture to be “de-AT,” I was still unable to reproduce the behavior you are seeing, but after handing the sample off to one of my teammates, she was able to reproduce the same behavior you are seeing. I am not at all sure what the difference is in this case, but I have asked our engineering teams to take a further look at the issue.
In order to ensure that this issue receives attention, I have logged it in our internal tracking systems with a development ID of 271141 and I have created you a private support case that I will be linking this issue to so that you can be notified when a fix or other resolution becomes available. The support case has an ID of CAS-208734-K5C6C8 and you can access it after signing into your account, here: https://ko.infragistics.com/my-account/support-activity.