I have following Problem when using a XamDataGrid bound to an ObservableCollection.
When i use a regular TextField to Display Data, the Text seems to be moved below the visible area while editing. The Text itself is correct and is being transfered to the Collection, however it is Kind of annoying not being able to see what you are typing:
However, when i use a MaskedTextField it Shows the Behaviour i want.:
Code of the DataGrid:
<custom:XamDataGrid Name="InvPosDisplay" Grid.Column="2" DataSource="{Binding LoadedPositions}" > <custom:XamDataGrid.FieldLayoutSettings> <custom:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True" AddNewRecordLocation="OnTop"/> </custom:XamDataGrid.FieldLayoutSettings> <custom:XamDataGrid.FieldSettings> <custom:FieldSettings AllowRecordFiltering="True" LabelClickAction="SortByMultipleFields" DataValueChangedNotificationsActive="True" /> </custom:XamDataGrid.FieldSettings> <custom:XamDataGrid.ViewSettings> <custom:GridViewSettings /> </custom:XamDataGrid.ViewSettings> <custom:XamDataGrid.FieldLayouts> <custom:FieldLayout> <custom:TextField Name="INV_NR" Label="INV_NR" AllowEdit="False" Width="80" ></custom:TextField> <custom:TextField Name="INV_DAT" Label="INV_DAT" AllowEdit="False"></custom:TextField> <custom:TextField Name="ART_NR" Label="ART_NR" Width="70"></custom:TextField> <custom:MaskedTextField Name="ART_BEZ" Label="ART_BEZ" Width="170"></custom:MaskedTextField> <custom:NumericField Name="ART_MENGE_FREI" Label="ART_MENGE_FREI" Width="100"> <custom:Field.Settings> <custom:FieldSettings EditorType="{x:Type custom:XamNumericEditor}" > <custom:FieldSettings.EditorStyle> <Style TargetType="{x:Type custom:XamNumericEditor}"> <Setter Property="Mask" Value ="{}{double:9.5}"/> </Style> </custom:FieldSettings.EditorStyle> </custom:FieldSettings> </custom:Field.Settings>
Is there a Way i can have the TextField display my text the same way as the MaskedTextfield does?
Hello,
Thank you for contacting the Infragistics.
I followed the steps you suggested and was unable to reproduce the behavior you're describing.
I created a sample of XamDataGrid and bound to an ObservableCollection.I have three type of field to display the data TextField, MaskedTextField and NumericField .Now when I run the sample and editing any of the fields the text doesn’t move below the visible area, it displays as expected.
I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, then the change in behavior is due to differences in your environment from mine and these differences can be anything from operating system version to the specific version of the Infragistics DLL versions used. My test was performed using version 18.1.20181.105. Please provide more details about your machine and version of the assemblies that you are referencing so that I can modify the environment that I am testing in to match yours.
If the project does show the product feature working correctly, then more information will be needed to reproduce the issue in a sample that can be used for debugging. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing. This can be done by either making the sample that I provided more like your application or by isolating the behavior from your application by removing dependencies on any third parties or databases.
Please let me know if any further questions on this matter.
XamDatagridTextField.zip
Thank you for your Reply, it has pointed me in the right direction:
In my Application i was using Styles from MaterialDesignThemes which were applied to TextBoxes. Since the Datagrid seems to be using regular TextBoxes in Edit Mode they were applied there as well.
Since the Masked and the numeric Editor had their own Style and overruled the global Style they were working as intended.
I solved this behaviour by simply using an empty Style for TextBoxes within the Grid Resources:
<custom:XamDataGrid.Resources> <Style TargetType="TextBox"></Style> </custom:XamDataGrid.Resources>
Hello ,
Thank you for the update.I am glad that you are able to solve the issue refering my sample.