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
240
Reg: XamWebTree Binding
posted

Hi,

I am binding XamWebTree with a List<>, i am getting this list from XML.  That list will have items and this list i am binding to XamWebTree as itemssource.  But instead of doing this way how can i give binding two way mode for this.  So that when ever the List<> got updated it needs to update the XamWebTree dynamically with out binding explicitly.  Can some body show the sample code for this?

Thanks in Advance.

Regards,

Amarendra.

 

 

 

Parents
  • 4493
    Suggested Answer
    posted

    Hello,

    You can't get two way binding with Generic List. You have to use a Generic ObservableCollection instead! You can create a local property of the page (or the model you have) that is of type ObservableCollection<someType>. Instatiate it, and bind the XamWebTree to it.

    Then you can manipulate that object (which is of type ObservableCollection<T>), based on the changed in the List<T> you have. Then you will have a two way (one way) binding.

    By the way, what you want is called One-Way binding - this is binding from underlying data source (ItemsSource) to the UI - any time the data source is changed, the UI is updated.

    Two way binding is when the UI changes lead to data changes also.

    One time binding is when data is bound only once and neither updes of the Data lead to update of UI, nor updates on the UI lead to upda of data;

    Hope this helps

Reply Children
No Data