コード例 #1
0
        protected override object GetRawValueInternal(IBindingMemberInfo targetMember, IDataContext context, bool throwOnError)
        {
            var values = new object[_sources.Length];

            for (int i = 0; i < _sources.Length; i++)
            {
                IBindingPathMembers members = _sources[i].GetPathMembers(true);
                object value = members.GetLastMemberValue();
                if (members.Path.IsDebuggable)
                {
                    DebugInfo($"MultiBinding got a raw value: '{value}', for path: '{members.Path}'", new[] { value, members });
                }
                if (value.IsDoNothing())
                {
                    return(BindingConstants.DoNothing);
                }
                if (value.IsUnsetValue())
                {
                    return(BindingConstants.UnsetValue);
                }
                values[i] = value;
            }
            if (_sources[0].Path.IsDebuggable)
            {
                DebugInfo("MultiBinding applying format expression", new object[] { _formatExpression, values });
                var result = _formatExpression(context, values);
                DebugInfo($"MultiBinding format expression returns value: '{result}'");
                return(result);
            }
            return(_formatExpression(context, values));
        }
コード例 #2
0
        protected override object GetRawValueInternal(IBindingMemberInfo targetMember, IDataContext context,
                                                      bool throwOnError)
        {
            IBindingPathMembers members = _bindingSource.GetPathMembers(throwOnError);
            var value = members.GetLastMemberValue();

            if (members.Path.IsDebuggable)
            {
                DebugInfo($"Binding got a raw value: '{value}', for path: '{members.Path}'", new[] { value, members });
            }
            return(value);
        }