public ArrayUIItem NewItem(BsonValue value, int?index)
        {
            var keyName   = value.Type.ToString();
            var arrayItem = new ArrayUIItem
            {
                Name  = $"{index}:{keyName}",
                Value = value,
                Index = index
            };

            var expandMode = OpenEditorMode.Inline;

            if (_windowController != null)
            {
                expandMode = OpenEditorMode.Window;
            }

            var valueEdit = BsonValueEditor.GetBsonValueEditor(
                openMode: expandMode,
                bindingPath: "Value",
                bindingValue: value,
                bindingSource: arrayItem,
                readOnly: IsReadOnly,
                keyName: keyName);

            arrayItem.Control = valueEdit;

            return(arrayItem);
        }
示例#2
0
        private DocumentFieldData NewField(string key, bool readOnly)
        {
            var expandMode = OpenEditorMode.Inline;

            if (_windowController != null)
            {
                expandMode = OpenEditorMode.Window;
            }

            var valueEdit =
                BsonValueEditor.GetBsonValueEditor(
                    openMode: expandMode,
                    bindingPath: $"[{key}]",
                    bindingValue: _currentDocument[key],
                    bindingSource: _currentDocument,
                    readOnly: readOnly,
                    keyName: key);

            return(new DocumentFieldData(key, valueEdit));
        }