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
145
UnboundFields in XamDataGrids not updating with the model
posted

Hi,

I am using a XamDataGrid to enter a collection of child models in to a single parent model. One of the fields on the grid is only editabled by a button click event. The event is working and the property is changed on the model but the grid does not show the new value. If I make the field editable and assign it a value manually then call the event, the grid will update with the new value.

I tested out different fields and all of them behave this way. I beleive this is due to using UnboundField, which is needed because of the model setup. It seems that the fields don't bind until data has been entered manaully, which in this case never happens. Is there a way to force the UnboundFields to take the values on the model even when the value changes in an events and is not user driven?

Data grid Xaml: <DataPresenter:XamDataGrid DataSource="{Binding Path=RootModel.Child}" IsEnabled="{Binding Path=NewOrExistingEditingEnabled}">
               
<DataPresenter:XamDataGrid.FieldSettings>
 <DataPresenter:FieldSettings AllowSummaries="True" AllowEdit="True" />
</DataPresenter:XamDataGrid.FieldSettings>

<DataPresenter:UnboundField BindingPath="PrimaryFields.MarkAsDeleted" BindingMode="TwoWay" Label="Deleted">
    <DataPresenter:UnboundField.Settings>
        <DataPresenter:FieldSettings AllowEdit="False" EditorType="Editors:XamCheckEditor" />
    </DataPresenter:UnboundField.Settings>
</DataPresenter:UnboundField>

Event Method: public void Delete (Model parent, int[ ] fooList){
 foreach (int i in List)
  parent.Child[fooList[i]].PrimaryFields.MarkAsDeleted = true;
}

Field: Parent.Child.PrimaryFields.MarkAsDeleted