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
210
Binding issue for Name property in xamDataGrid Field.
posted

I am having trouble getting this to work:

<igWpf:Field Row="2" Column="25" Name="{Binding Path=TrustGL.GLAccountNumber, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Label="Cost Center"/>

i also tried:

<igWpf:Field Row="2" Column="25" Name="{Binding Path=DataContext.TrustGL.GLAccountNumber, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Label="Cost Center"/>

<igWpf:Field Row="2" Column="25" Name="{igWpf:FieldBinding TrustGL.GLAccountNumber}" Label="Cost Center"/>

None of these seem to work.

Can you tell me what is required?

TrustGL is an object in an object in a collection that the DataSource is using.

 

Parents
  • 34510
    Offline posted

    Hi Edward,

    If TrustGL is an object inside of another object inside of a collection then none of these bindings will work.  The first thing I want to mention is that the Field class is not a FrameworkElement or DependencyObject so it is not part of the Visual Tree and it does not inherit a DataContext like a typical control would.  The DataContext property on the Field class is something Infragistics added and we set it up so that it would work in a similar manner.  The issue is, a typical binding such as "{Binding Path=TrustGL.GLAccountNumber}" won't work.  You need to specify a source for the binding.  The typical way to do this is by using "RelativeSource={RelativeSource Self}".  So:

    "{Binding RelativeSource={RelativeSource Self}, Path=DataContext.MyViewModelProperty}"

    Since your TrustGL object is inside another object which is inside a collection then your binding path needs to include this collection, accessing a specific item in this collection and then accessing TrustGL.  I don't know what the exact path should look like since I don't know what your structure actually looks like but it sounds like it should be something like this:

    Path=DataContext.MyCollection[0].MyObject.TrustGL

Reply Children