private async void OnMemberExpandedInternal(DataFilterFieldSelector fieldSelector)
        {
            var subfields = (await fieldSelector.Load()).ToArray();

            if (subfields.Any())
            {
                var selectedMember = subfields.First();
                MemberSelectors.Add(new DataFilterFieldSelector(this, subfields, selectedMember));

                if (FilterDescriptor != null)
                {
                    FilterDescriptor.Member = selectedMember.PropertyName;
                }
            }
        }
        /// <summary>
        /// Notifies the selector that a member has been collapsed.
        /// </summary>
        /// <param name="fieldSelector">
        /// The member selector.
        /// </param>
        public void OnMemberCollapsed(DataFilterFieldSelector fieldSelector)
        {
            if (fieldSelector == null)
                throw new ArgumentNullException("fieldSelector");

            if (FilterDescriptor != null)
            {
                FilterDescriptor.Member = fieldSelector.SelectedMember.PropertyName;
            }
        }
        private void AddMemberSelectors(FieldPathPropertyDefinition propertyDefinition, bool isLast)
        {
            if (propertyDefinition.ParentProperty != null)
            {
                AddMemberSelectors(propertyDefinition.ParentProperty, false);
            }

            var availableMembers =
                AvailableMembers.Select(x => x.ItemPropertyDefinition)
                                .OfType<FieldPathPropertyDefinition>()
                                .Where(x => x.ParentProperty == propertyDefinition.ParentProperty);

            var memberSelector = new DataFilterFieldSelector(this, availableMembers, propertyDefinition, !isLast);

            MemberSelectors.Add(memberSelector);
        }
        /// <summary>
        /// Notifies the selector that a member has been expanded.
        /// </summary>
        /// <param name="fieldSelector">
        /// The member selector.
        /// </param>
        public void OnMemberExpanded(DataFilterFieldSelector fieldSelector)
        {
            if (fieldSelector == null)
                throw new ArgumentNullException("fieldSelector");

            OnMemberExpandedInternal(fieldSelector);
        }