Catel.MVVM.Views.ViewToViewModelMappingHelper.TransferValueFromViewModelToView C# (CSharp) Method

TransferValueFromViewModelToView() protected method

Transfers the value from a view model property to the view property. This method does nothing when viewModel is null.
This method does not check the type of the properties. If the types are incorrect, an exception will be thrown by the .NET Framework.
The is null or whitespace. The is null or whitespace.
protected TransferValueFromViewModelToView ( IViewModel viewModel, string viewPropertyName, string viewModelPropertyName ) : void
viewModel IViewModel The view model.
viewPropertyName string Name of the view property.
viewModelPropertyName string Name of the view model property.
return void
        protected void TransferValueFromViewModelToView(IViewModel viewModel, string viewPropertyName, string viewModelPropertyName)
        {
            Argument.IsNotNullOrWhitespace("viewPropertyName", viewPropertyName);
            Argument.IsNotNullOrWhitespace("viewModelPropertyName", viewModelPropertyName);

            if (viewModel == null)
            {
                Log.Warning("Cannot transfer value from view model to view because view model is null");
                return;
            }

            Log.Debug("Ignore next property changed event for view.'{0}'", viewPropertyName);

            if (!_ignoredViewChanges.Contains(viewPropertyName))
            {
                _ignoredViewChanges.Add(viewPropertyName);
            }

            TransferValue(viewModel, viewModelPropertyName, ViewModelContainer, viewPropertyName);

            Log.Debug("No longer ignoring next property changed event for view.'{0}'", viewPropertyName);

            _ignoredViewChanges.Remove(viewPropertyName);
        }