Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
640
Problems using Unboundfield BindingMode.TwoWay. It only works 1 time.
posted

Hi there,

we have a issue with multiple unboundfields in the XamDataGrid. 

When using them, and setting the BindingMode on TwoWay it only updates the Cell or ObjectProperty once.

For example:

We have Length as a property of documentline. This is added to the grid as an UnboundField.
When adding or editing a documentline we change length from 1 to 4. This is correct and also changed. When we enter the Length field again and fill in for example 5 it changes back to 4 on exit of the field. Everything we have tried doesnt help. We are hoping you can help us.

This is the code we use to add a field to the XamDataGrid:

            UnboundField unboundField = new UnboundField();
            String fieldName = "Length";

            FieldLayout fieldLayout = null;

            unboundField.Visibility = visibility;

            if (unboundField.Visibility == Visibility.Hidden)
                return unboundField;

            //Always Disabeled!!! One way binding...
            if (bindingMode == BindingMode.OneWay)
                unboundField.Settings.AllowEdit = false;

            //If no FieldLayout exists create one...
            if (xamDataGrid.FieldLayouts.Count == 0)
                xamDataGrid.FieldLayouts.Add(new FieldLayout());
            if (xamDataGrid.FieldLayouts.Count > 0)
                fieldLayout = xamDataGrid.FieldLayouts[0];

            if (fieldLayout == null)
                return unboundField;

            fieldLayout.Settings.AutoGenerateFields = false;

            //Add field
            unboundField.Name = fieldName;
            unboundField.Label = ResourceManager.GetResourceStrByKeyLang(resourceAuthKey);
            unboundField.ToolTip = unboundField.Label;
            unboundField.Width = new FieldLength(fieldWitdh);

            unboundField.BindingPath = new PropertyPath(GetBindingFromResAuthKey(resourceAuthKey));
            unboundField.BindingMode = bindingMode;

            if (editorType != null)
                unboundField.Settings.EditorType = editorType;
            else
                unboundField.Settings.EditorType = typeof(XamTextEditor);

            fieldLayout.Fields.Add(unboundField);

 

Parents Reply Children
No Data