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
385
unbound field 3 levels deep into the View Model - Binding issue
posted

I was trying to bind the grid to a data model where the hierarchy  is 3 levels deep: 

In the example code: I want to bind the grid to : ValueInnerInner, but this does not work.

 

 

public class ViewModel

    {

        public ViewModel()

        {

            DataSource = new ObservableCollection<SomeModel>();

            DataSource.Add(new SomeModel());

 

        }

 

        public ObservableCollection<SomeModel> DataSource

        {

            get;

            private set;

        } 

    } 

 

    public class SomeModel

    {

        public SomeModelInner Inner

        {

            get;

            set; 

        } 

 

        public SomeModel()

        {

            Inner = new SomeModelInner();

        }

    }

 

    public class SomeModelInner

    {

        public int Value

        {

            get

            {

                return 200;

            }

        } 

 

        public SomeModelInnerInner InnerInner

        {

            get;

            set;

        } 

 

        public SomeModelInner()

        {

 

        }

    }

 

    public class SomeModelInnerInner

    {

        public int ValueInnerInner

        {

            get

            {

                return 200;

            } 

        } 

 

        public SomeModelInnerInner()

        {

 

        }

    }


Parents
No Data
Reply
  • 385
    posted

     

     

     

     

     

     

     

     

     

     

     

     

     

    here is the layout value for the above problem:

    <

     

     

    ig:XamDataGrid.FieldLayouts

    >

     

     

     

    <ig:FieldLayout Key

    ="XamGridLayout">

     

     

     

    <ig:UnboundField

     

     

    Name="Value"

     

     

    Label="Inner Value"

     

     

    BindingPath

    ="Inner.Value"

     

     

     

    />

     

     

     

     

    <ig:UnboundField

     

     

    Name="ValueInnerInner"

     

     

    Label="Inner Inner Value"

     

     

    BindingPath

    ="Inner.InnerInner.ValueInnerInner"

     

     

     

    />

     

     

     

    </ig:FieldLayout

    >

     

     

     

     

    </ig:XamDataGrid.FieldLayouts

    >

Children