MvvmCross.Binding.BindingContext.MvxTaskBasedBindingContext.OnDataContextChange C# (CSharp) Méthode

OnDataContextChange() protected méthode

Must be called on main thread as it creates the target bindings, and creating target bindings might subscribe to events that needs to be done on main thread (like touchupinside). If the code is run in Synchronous mode there will be a performance hit, there are however some use-cases(iOS automatic resizing cells).
protected OnDataContextChange ( ) : void
Résultat void
        protected virtual void OnDataContextChange()
        {
            if (this._delayedActions.Count != 0)
            {
                foreach (var action in this._delayedActions)
                {
                    action();
                }
                this._delayedActions.Clear();
            }

            Action setBindingsAction = (() =>
                {
                    foreach (var binding in this._viewBindings)
                    {
                        foreach (var bind in binding.Value)
                        {
                            bind.Binding.DataContext = this._dataContext;
                        }
                    }

                    foreach (var binding in this._directBindings)
                    {
                        binding.Binding.DataContext = this._dataContext;
                    }
                });

            if (RunSynchronously)
                setBindingsAction();
            else 
                Task.Run(setBindingsAction);
        }