コード例 #1
0
        private SceneNode CreateDataGridTemplateColumn(DataSchemaNodePath schemaPath)
        {
            DataGridColumnNode dataGridColumnNode = (DataGridColumnNode)this.DragModel.ViewModel.CreateSceneNode(ProjectNeutralTypes.DataGridTemplateColumn);
            string             columnName         = DataBindingDragDropDefaultHandler.GetColumnName(schemaPath);

            dataGridColumnNode.SetLocalValue(DataGridColumnNode.ColumnHeaderProperty, (object)columnName);
            string resourceNameBase        = columnName + "Template";
            List <DataSchemaNodePath> list = new List <DataSchemaNodePath>()
            {
                schemaPath
            };

            DataViewFactory.CreateDataTemplateResource((SceneNode)dataGridColumnNode, DataGridColumnNode.TemplateColumnCellTemplateProperty, resourceNameBase, (IList <DataSchemaNodePath>)list, DataViewCategory.DataTemplate, PlatformTypes.DataTemplate);
            return((SceneNode)dataGridColumnNode);
        }
コード例 #2
0
        private SceneNode CreateDataGridBoundColumn(DataSchemaNodePath schemaPath, ITypeId columnType)
        {
            DataGridColumnNode dataGridColumnNode = (DataGridColumnNode)this.DragModel.ViewModel.CreateSceneNode(columnType);
            string             columnName         = DataBindingDragDropDefaultHandler.GetColumnName(schemaPath);

            dataGridColumnNode.SetLocalValue(DataGridColumnNode.ColumnHeaderProperty, (object)columnName);
            BindingSceneNode bindingSceneNode = (BindingSceneNode)this.DragModel.ViewModel.CreateSceneNode(PlatformTypes.Binding);

            bindingSceneNode.SetPath(schemaPath.Path);
            BindingModeInfo defaultBindingMode = BindingPropertyHelper.GetDefaultBindingMode(dataGridColumnNode.DocumentNode, DataGridColumnNode.BoundColumnBindingProperty, schemaPath);

            if (!defaultBindingMode.IsOptional)
            {
                bindingSceneNode.Mode = defaultBindingMode.Mode;
            }
            dataGridColumnNode.SetValueAsSceneNode(DataGridColumnNode.BoundColumnBindingProperty, (SceneNode)bindingSceneNode);
            return((SceneNode)dataGridColumnNode);
        }