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
1240
Unexplainable Binding Errors against FieldLayout.AutoFitToWidth
posted

We're using XamDataGrid v11.2 and we get one BindingExpression path error for each XamDataGrid as it renders. The whole message is:

BindingExpression path error: 'FieldLayout' property not found on 'object' ''GridUserControl' (Name='')'. BindingExpression:Path=FieldLayout.AutoFitToWidth; DataItem='GridUserControl' (Name=''); target element is 'DataRecordPresenter' (Name=''); target property is 'NoTarget' (type 'Object')

The data context for the whole user control is pointing to our GridUserControl object and the XamDataGrid inherits that data context (we set the DataSource for the grid). The binding expression (FieldLayout.AutoFitToWidth) must be something internal to the XamDataGrid. I have searched our code completely (not case sensitive, not whole word, entire soluton, *.*) and there are no occurances of AutoFitToWidth (and any occurances of FieldLayout are not used in binding expressions).

Am I right that this is an internal issue with XamDataGrid v11.2? Is there anything I can do to get rid of this error (we log all binding errors and customers may be confused if they see this in our log)?

Thanks,

Mike

Parents
  • 54937
    Offline posted

    One of the triggers in the RecordPresenter derived elements (e.g. DataRecordPresenter) is using that path. The DataContext of the RecordPresenter is the associated Record however the DataContext probably isn't set until the prepare for the RecordListControl (as is common in ItemsControl implementations) but that is probably after the Panel has added the element to the visual tree so you're datacontext temporarily was applied to the container (e.g. the DataRecordPresenter in this case). We can change the triggers in an upcoming SR. If you need to address this for now you would need to provide a custom style for the DataRecordPresenter (and possibly other elements like SummaryRecordPresenter, etc.) where you change that trigger and add RelativeSource={RelativeSource Self}.You would need to take the style we provide in the DefaultStyles directory and use that as the starting point.

Reply Children