コード例 #1
0
        protected override LabelEditResult OnCreatorNodeEditCommitted(int index, object value, int insertIndex)
        {
            var columnName = value as string;

            if (!string.IsNullOrEmpty(columnName))
            {
                var treeGridColumns = GetColumns();
                Debug.Assert(
                    treeGridColumns != null && treeGridColumns.Length > 0, "TreeGridColumns does not have expected number of columns");

                if (treeGridColumns != null &&
                    treeGridColumns.Length > 0)
                {
                    var treeGridColumn = treeGridColumns[0];
                    Debug.Assert(treeGridColumn != null, "First TreeGridColumn is null");
                    if (treeGridColumn != null)
                    {
                        var mc         = new MappingCondition(_mappingStorageEntityType.Context, null, _mappingStorageEntityType);
                        var lovElement = mc.FindMappingLovElement(columnName, ListOfValuesCollection.FirstColumn);

                        // if lovElement is LovEmptyPlaceHolder then user is clicking off the 'Empty'
                        // entry in the drop-down list and there's nothing to insert
                        if (lovElement != null &&
                            lovElement != MappingEFElement.LovEmptyPlaceHolder)
                        {
                            treeGridColumn.SetValue(mc, lovElement);
                            DoBranchModification(BranchModificationEventArgs.InsertItems(this, insertIndex, 1));
                            return(LabelEditResult.AcceptEdit);
                        }
                    }
                }
            }

            return(base.OnCreatorNodeEditCommitted(index, value, insertIndex));
        }
コード例 #2
0
        internal override object GetCreatorElement()
        {
            var mc = new MappingCondition(null, null, _mappingStorageEntityType);

            return(mc);
        }