Ejemplo n.º 1
0
        /// <summary>
        ///     Gets the raw value from source.
        /// </summary>
        protected override object GetRawValueInternal(IBindingMemberInfo targetMember, IDataContext context,
                                                      bool throwOnError)
        {
            IBindingPathMembers members = _bindingSource.GetPathMembers(throwOnError);

            return(members.LastMember.GetValue(members.PenultimateValue, null));
        }
Ejemplo n.º 2
0
        private static void SetDefaultValue(IBindingSource source)
        {
            var pathMembers = source.GetPathMembers(false);

            if (pathMembers.AllMembersAvailable)
            {
                pathMembers.LastMember.SetValue(pathMembers.PenultimateValue,
                                                new[] { pathMembers.LastMember.Type.GetDefaultValue() });
            }
        }
Ejemplo n.º 3
0
        private void OneTimeSourceHandler(IBindingSource sender, ValueChangedEventArgs args)
        {
            var members = sender.GetPathMembers(false);

            if (!members.AllMembersAvailable)
            {
                return;
            }
            UnsubscribeSources(OneTimeSourceHandler);
            Binding.UpdateSource();
        }
Ejemplo n.º 4
0
        private void TrySubscribe(IBindingSource source)
        {
            var dataErrorInfo = source.GetPathMembers(false).PenultimateValue as INotifyDataErrorInfo;

            if (dataErrorInfo == null)
            {
                return;
            }
            var subscriber = BindingServiceProvider.WeakEventManager.TrySubscribe(dataErrorInfo, ErrorsChangedEvent, this);

            if (subscriber != null)
            {
                _subscribers.Add(subscriber);
            }
        }
Ejemplo n.º 5
0
        private void CollectErrors(ref List <object> errors, IBindingSource bindingSource)
        {
            var notifyDataErrorInfo = bindingSource.GetPathMembers(false).PenultimateValue as INotifyDataErrorInfo;

            if (notifyDataErrorInfo == null)
            {
                return;
            }
            var path  = bindingSource.Path.Parts.LastOrDefault();
            var paths = ErrorPaths;

            if (!string.IsNullOrEmpty(path) || paths == null || paths.Length == 0)
            {
                CollectErrors(notifyDataErrorInfo, path, ref errors);
            }
            if (paths != null)
            {
                for (int i = 0; i < paths.Length; i++)
                {
                    CollectErrors(notifyDataErrorInfo, paths[i], ref errors);
                }
            }
        }
 private void CollectErrors(ref List<object> errors, IBindingSource bindingSource)
 {
     var notifyDataErrorInfo = bindingSource.GetPathMembers(false).PenultimateValue as INotifyDataErrorInfo;
     if (notifyDataErrorInfo == null)
         return;
     var path = bindingSource.Path.Parts.LastOrDefault();
     var paths = ErrorPaths;
     if (!string.IsNullOrEmpty(path) || paths == null || paths.Length == 0)
         CollectErrors(notifyDataErrorInfo, path, ref errors);
     if (paths != null)
     {
         for (int i = 0; i < paths.Length; i++)
             CollectErrors(notifyDataErrorInfo, paths[i], ref errors);
     }
 }
 private void TrySubscribe(IBindingSource source)
 {
     var dataErrorInfo = source.GetPathMembers(false).PenultimateValue as INotifyDataErrorInfo;
     if (dataErrorInfo == null)
         return;
     var subscriber = BindingServiceProvider.WeakEventManager.TrySubscribe(dataErrorInfo, ErrorsChangedEvent, this);
     if (subscriber != null)
         _subscribers.Add(subscriber);
 }
 private void SetDefaultValue(IBindingSource source)
 {
     var pathMembers = source.GetPathMembers(false);
     if (pathMembers.AllMembersAvailable)
     {
         object value = _value;
         if (!pathMembers.LastMember.Type.IsInstanceOfType(value))
             value = pathMembers.LastMember.Type.GetDefaultValue();
         pathMembers.LastMember.SetValue(pathMembers.PenultimateValue, new[] { value });
     }
 }