Esempio n. 1
0
        protected override void CollectPropertyLists()
        {
            var bindingMode = (BindingMode)_bindingModeProp.enumValueIndex;

            base.CollectPropertyLists();

            if (_viewModelChanged)
            {
                _srcNames.Value = null;
                _srcPaths.Value = null;
            }

            if (string.IsNullOrEmpty(_viewModelProp.Value))
            {
                return;
            }

            var view = _dstViewProp.objectReferenceValue as Component;

            _srcNames.Clear();
            _srcPaths.Clear();
            _dstNames.Clear();
            _dstPaths.Clear();

            _dstChangeEvents.Clear();


            if (view)
            {
                var dstNeedsGetter = bindingMode != BindingMode.OneWay;
                var dstNeedsSetter = bindingMode != BindingMode.OneWayToSource;

                _dstNames.Values        = view.GetBindablePropertyList(needsGetter: dstNeedsGetter, needsSetter: dstNeedsSetter);
                _dstPaths.Values        = view.GetPropertiesAndFieldsList(_dstNames.Value);
                _dstChangeEvents.Values = view.GetBindableEventsList();
            }
            else
            {
                _dstNames.Value        = null;
                _dstPaths.Value        = null;
                _dstChangeEvents.Value = null;
            }

            var vmType = ViewModelProvider.GetViewModelType(ViewModelName);

            _srcNames.Values = ViewModelProvider.GetViewModelPropertyList(ViewModelName);

            var propType = vmType.GetProperty(_srcNames.Value)?.PropertyType;

            if (propType != null)
            {
                _srcPaths.Values = propType.GetNestedFields();
            }
        }
Esempio n. 2
0
        protected override void CollectPropertyLists()
        {
            base.CollectPropertyLists();

            if (_viewModelChanged)
            {
                _srcCollectionNames.Value = null;
            }

            _srcCollectionNames.Clear();


            _srcCollectionNames.Values
                = ViewModelProvider.GetViewModelPropertyList <INotifyCollectionChanged>(_viewModelProp.Value);
        }
Esempio n. 3
0
        protected override void CollectPropertyLists()
        {
            base.CollectPropertyLists();

            if (_viewModelChanged)
            {
                _srcNames.Value = null;
                _srcPaths.Value = null;
            }

            if (string.IsNullOrEmpty(_viewModelProp.Value))
            {
                return;
            }

            var view = _dstViewProp.objectReferenceValue as Component;

            _srcNames.Clear();
            _srcPaths.Clear();
            _dstNames.Clear();
            _dstPaths.Clear();


            if (view)
            {
                _dstNames.Values = view.GetBindablePropertyList(needsGetter: false);
                _dstPaths.Values = view.GetPropertiesAndFieldsList(_dstNames.Value);
            }
            else
            {
                _dstNames.Value = null;
                _dstPaths.Value = null;
            }

            var vmType = ViewModelProvider.GetViewModelType(ViewModelName);

            _srcNames.Values = ViewModelProvider.GetViewModelPropertyList(ViewModelName);

            var propType = vmType.GetProperty(_srcNames.Value)?.PropertyType;

            if (propType != null)
            {
                _srcPaths.Values = propType.GetNestedFields();
            }
        }
        protected override void CollectPropertyLists()
        {
            var myClass = target as CollectionViewBase;

            _selectedItemNames.Clear();
            _selectedItemCollectionNames.Clear();

            var collectionName = myClass.SrcCollectionName;

            if (!string.IsNullOrEmpty(collectionName))
            {
                var list = new List <string>();

                var listType = ViewModelProvider
                               .GetViewModelType(myClass.ViewModelName)
                               .GetProperty(collectionName)
                               .PropertyType
                               .GenericTypeArguments
                               .FirstOrDefault();

                var listCollectionType = typeof(ObservableCollection <>)
                                         .MakeGenericType(listType);


                list.Add("--");
                list.AddRange(ViewModelProvider.GetViewModelPropertyList(myClass.ViewModelName,
                                                                         _canSelectMultipleProp.boolValue ? listCollectionType : listType));

                if (_canSelectMultipleProp.boolValue)
                {
                    _selectedItemCollectionNames.Values = list;
                }
                else
                {
                    _selectedItemNames.Values = list;
                }
            }
        }