Ejemplo n.º 1
0
        public void RemoveChild(MapValueViewModel child)
        {
            var value = Value;

            if (!(value is Array))
            {
                throw new Exception($"Cannot remove child from none array item {Key}");
            }

            var array = (Array)value;

            array.Remove(child.Map);
            Value = array;
        }
Ejemplo n.º 2
0
        public MapValueViewModel(string key, Map Map, MapValueViewModel parent)
        {
            _key = key;
            _map = Map;

            // Run validation
            var value = _map[_key];

            ValidateValue(value);

            if (value is Array array)
            {
                array.CollectionChanged += Array_CollectionChanged;
            }

            _map.PropertyChanged += _Map_PropertyChanged;
            foreach (var innerValue in _map.Values)
            {
                if (innerValue is Map map)
                {
                    map.PropertyChanged += _Map_PropertyChanged;
                }
            }
        }