@@ -133,6 +133,7 @@ export class View extends proxy.ProxyObject implements definition.View {
133133 public _cssClasses : Array < string > = [ ] ;
134134
135135 private _gesturesObserver : gestures . GesturesObserver ;
136+ private _updatingInheritedProperties : boolean ;
136137
137138 public _options : definition . Options ;
138139
@@ -397,24 +398,40 @@ export class View extends proxy.ProxyObject implements definition.View {
397398
398399 public _onPropertyChanged ( property : dependencyObservable . Property , oldValue : any , newValue : any ) {
399400 super . _onPropertyChanged ( property , oldValue , newValue ) ;
400- // Implement Binding inheritance here.
401401
402402 if ( this . _childrenCount > 0 ) {
403403 var shouldUpdateInheritableProps = ( ( property . metadata && property . metadata . inheritable ) &&
404- property . name !== "bindingContext" &&
405404 ! ( property instanceof styling . Property ) ) ;
405+ var that = this ;
406406 if ( shouldUpdateInheritableProps ) {
407407 var notifyEachChild = function ( child : View ) {
408- child . _setValue ( property , newValue , dependencyObservable . ValueSource . Inherited ) ;
408+ child . _setValue ( property , that . _getValue ( property ) , dependencyObservable . ValueSource . Inherited ) ;
409409 return true ;
410410 } ;
411+ this . _updatingInheritedProperties = true ;
411412 this . _eachChildView ( notifyEachChild ) ;
413+ this . _updatingInheritedProperties = false ;
412414 }
413415 }
414416
415417 this . _checkMetadataOnPropertyChanged ( property . metadata ) ;
416418 }
417419
420+ public _isInheritedChange ( ) {
421+ if ( this . _updatingInheritedProperties ) {
422+ return true ;
423+ }
424+ var parentView : View ;
425+ parentView = < View > ( this . parent ) ;
426+ while ( parentView ) {
427+ if ( parentView . _updatingInheritedProperties ) {
428+ return true ;
429+ }
430+ parentView = < View > ( parentView . parent ) ;
431+ }
432+ return false ;
433+ }
434+
418435 public _checkMetadataOnPropertyChanged ( metadata : dependencyObservable . PropertyMetadata ) {
419436 if ( metadata . affectsLayout ) {
420437 this . requestLayout ( ) ;
@@ -675,21 +692,6 @@ export class View extends proxy.ProxyObject implements definition.View {
675692 return changed ;
676693 }
677694
678- public _onBindingContextChanged ( oldValue : any , newValue : any ) {
679- super . _onBindingContextChanged ( oldValue , newValue ) ;
680-
681- if ( this . _childrenCount === 0 ) {
682- return ;
683- }
684-
685- var thatContext = this . bindingContext ;
686- var eachChild = function ( child : View ) : boolean {
687- child . _setValue ( bindable . Bindable . bindingContextProperty , thatContext , dependencyObservable . ValueSource . Inherited ) ;
688- return true ;
689- }
690- this . _eachChildView ( eachChild ) ;
691- }
692-
693695 private _applyStyleFromScope ( ) {
694696 var rootPage = getAncestor ( this , "Page" ) ;
695697 if ( ! rootPage || ! rootPage . isLoaded ) {
@@ -784,7 +786,7 @@ export class View extends proxy.ProxyObject implements definition.View {
784786 private _inheritProperties ( parentView : View ) {
785787 var that = this ;
786788 var inheritablePropertySetCallback = function ( property : dependencyObservable . Property ) {
787- if ( property instanceof styling . Property || property . name === "bindingContext" ) {
789+ if ( property instanceof styling . Property ) {
788790 return true ;
789791 }
790792 if ( property . metadata && property . metadata . inheritable ) {
@@ -827,7 +829,7 @@ export class View extends proxy.ProxyObject implements definition.View {
827829
828830 view . _setValue ( bindable . Bindable . bindingContextProperty , undefined , dependencyObservable . ValueSource . Inherited ) ;
829831 var inheritablePropertiesSetCallback = function ( property : dependencyObservable . Property ) {
830- if ( property instanceof styling . Property || property . name === "bindingContext" ) {
832+ if ( property instanceof styling . Property ) {
831833 return true ;
832834 }
833835 if ( property . metadata && property . metadata . inheritable ) {
@@ -892,4 +894,4 @@ export class View extends proxy.ProxyObject implements definition.View {
892894 public focus ( ) : boolean {
893895 return undefined ;
894896 }
895- }
897+ }
0 commit comments