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
515
How to fill unbound data after adding fieldlayout - Initialize record is not fired.
posted

Dear all,

i'm back on my evaluation and i thank you so far for your help. I'm through with the WinForm-Grid and it quite impressed me because the features are very rich and very well thought and defined. Also the object model is one of the clearest i saw among other competitors. Especially i like the many interfaces for implementing custom strategies. And the sample application is also really the best i saw. Up to now infragistics is clearly our favorite!

Now i'm on the WPF-Controls and i have my first problem with the XamGrid:

I'm adding a unbound field to the field layout list and i'm expecting the Initialize record event to be fired to fill the data but nothing happens. So the unbound field i added remains empty.

How shall i proceed to fill unbound data after adding a unbound field at runtime?

Code (Vb):

' => called uppon setting checkbox for 'UnboundDemo' after the grid was bound to a DataView:

Protected Overrides Sub UseUnboundModeEnter()

             Dim aFieldLayout As FieldLayout = Me.FieldLayout
            Dim aUnboundField As New UnboundField
            aUnboundField.Label = "UnboundField"
            aUnboundField.DataType = GetType(String)
            Me.UseUnboundModeUnboundField = aUnboundField
            Me.FieldLayout.Fields.Insert(0, aUnboundField) ' => I'm expecting Grid.InitializeRecord

End Sub

   ' event handler Grid.InitializeRecord: Here i fill unbound data

    Private Sub UseUnboundModeFillData(ByVal sender As Object, ByVal e As _   

       Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs) Handles Grid.InitializeRecord


        If TryCast(e.Record, DataRecord) IsNot Nothing Then
            Dim aDataRecord As DataRecord = DirectCast(e.Record, DataRecord)
            Dim aUnboundField As UnboundField = Me.UseUnboundModeUnboundField
            If aUnboundField IsNot Nothing Then
                If aDataRecord.FieldLayout.Fields.Contains(aUnboundField) Then
                    aDataRecord.Cells(aUnboundField).Value = "UnboundData[" & aDataRecord.Index & "]"
                End If
            End If
        End If
    End Sub

Parents
  • 69686
    Suggested Answer
    posted

    Hello,

    Unlike the normal field, which uses its name property to find the underlying object's property, the UnboundField uses the BindingPath property. So, if you want to bind your UnboundField to the underlying source, you have to set this. 

Reply Children
No Data