internal void UpdateDataSourcePropertyValue(string propertyName)
        {
            if (!listenForViewModelChanges)
            {
                return;
            }
            if (String.IsNullOrEmpty(propertyName))
            {
                return;
            }

            var elements = xmlLayout.GetElementsForDataSource(propertyName, propertyName);

            if (elements.Count > 0)
            {
                object value = MVVMUtilities.GetNestedMemberValue(typeof(T), propertyName, viewModel);

                if (value is IObservableList)
                {
                    elements.ForEach(e => e.SetListData((IObservableList)value));
                }
                else
                {
                    elements.ForEach(e => e.SetValue(value != null ? value.ToString() : null, false));
                }
            }
        }
        /// <summary>
        /// Set the value of a ViewModel field or property
        /// </summary>
        /// <param name="memberName"></param>
        /// <param name="newValue"></param>
        public void SetValue(string memberName, object newValue)
        {
            MVVMUtilities.SetNestedMemberValue(this.GetType(), memberName, this, newValue, controller.xmlLayout);

            /*
             * var memberInfo = GetType().GetMember(memberName).FirstOrDefault();
             *
             * if (memberInfo != null)
             * {
             *  var valueBefore = GetValue(memberName);
             *
             *  if (valueBefore != newValue)
             *  {
             *      var newValueType = newValue.GetType();
             *      var memberDataType = memberInfo.GetMemberDataType();
             *
             *      if (newValueType == typeof(System.String) && newValueType != memberDataType)
             *      {
             *          memberInfo.SetMemberValue(this, ((string)newValue).ChangeToType(memberDataType, this.controller.xmlLayout));
             *      }
             *      else
             *      {
             *          memberInfo.SetMemberValue(this, newValue);
             *      }
             *  }
             * }*/
        }
        public override void ViewModelMemberChanged(string memberName)
        {
            if (!listenForViewModelChanges)
            {
                return;
            }

            // if this member is inline, then a complete rebuild is necessary
            if (xmlLayout.Xml.Contains("{" + memberName + "}"))
            {
                ViewModelUpdated();
                return;
            }

            // otherwise, look for the element(s) using the data source string
            var elements = xmlLayout.GetElementsForDataSource(memberName, memberName);

            if (elements.Count > 0)
            {
                object value = MVVMUtilities.GetNestedMemberValue(typeof(T), memberName, viewModel);

                if (value is IObservableList)
                {
                    elements.ForEach(e => e.SetListData((IObservableList)value));
                }
                else
                {
                    elements.ForEach(e => e.SetValue(value != null ? value.ToString() : null, false));
                }
            }

            return;
        }
 /// <summary>
 /// Get the value of a field or property
 /// </summary>
 /// <param name="memberName"></param>
 /// <returns></returns>
 public object GetValue(string memberName)
 {
     return(MVVMUtilities.GetNestedMemberValue(GetType(), memberName, this));
 }