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
660
Force update for validation to fire in unboundfield
posted

I currently use a routine to loop the data bound objects of my forms so that I can call BindingExpression.UpdateSource() and check for errors using IDataErrorInfo.

I would like to do the same thing for my xamDataGrids bound to a custom IBindingList List of custom data objects. So after about half a days worth of research on this forum I wrote the following routine and several variations. 

However my validation routine never fires as the setter is never called for any of the properties of the custom data objects that I am using. I have tried several tricks to set the active cell and start and end the edit modes. I have played with some RoutedCommands with no luck. Is there any trick to getting the datagrid to fire an equivalent to UpdateSource(). 

 

    Public Function areGridsValid(ByVal parent As DependencyObject) As Boolean

        Dim valid As Boolean = True

        For i = 0 To VisualTreeHelper.GetChildrenCount(parent) - 1

            If VisualTreeHelper.GetChild(parent, i).GetType Is GetType(XamDataGrid) Then

                Dim grid As XamDataGrid = VisualTreeHelper.GetChild(parent, i)

                For Each record As Infragistics.Windows.DataPresenter.DataRecord In grid.Records

                    For Each cell As Infragistics.Windows.DataPresenter.Cell In record.Cells

                        Dim cvp As CellValuePresenter = CellValuePresenter.FromCell(cell)

                        If cvp IsNot Nothing Then

                            Dim be As BindingExpression = cvp.GetBindingBLOCKED EXPRESSION

        Next

        Return valid

    End Function

 

 

Thank you