Beispiel #1
0
        private bool SetDataSourceIDCallback(object context)
        {
            string str = (string)context;
            DataBoundControlDesigner designer = this._controlDesigner as DataBoundControlDesigner;

            if (designer != null)
            {
                TypeDescriptor.GetProperties(designer.Component)["DataSourceID"].SetValue(designer.Component, str);
            }
            else
            {
                BaseDataListDesigner designer2 = this._controlDesigner as BaseDataListDesigner;
                if (designer2 != null)
                {
                    TypeDescriptor.GetProperties(designer2.Component)["DataSourceID"].SetValue(designer2.Component, str);
                }
                else
                {
                    RepeaterDesigner designer3 = this._controlDesigner as RepeaterDesigner;
                    if (designer3 != null)
                    {
                        TypeDescriptor.GetProperties(designer3.Component)["DataSourceID"].SetValue(designer3.Component, str);
                    }
                }
            }
            return(true);
        }
Beispiel #2
0
        /// <include file='doc\ColumnCollectionEditor.uex' path='docs/doc[@for="DataGridColumnCollectionEditor.EditValue"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Edits the value specified.
        ///    </para>
        /// </devdoc>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IDesignerHost designerHost = (IDesignerHost)context.GetService(typeof(IDesignerHost));

            Debug.Assert(designerHost != null, "Did not get DesignerHost service.");

            Debug.Assert(context.Instance is DataGrid, "Expected datagrid");
            DataGrid dataGrid = (DataGrid)context.Instance;

            BaseDataListDesigner designer = (BaseDataListDesigner)designerHost.GetDesigner(dataGrid);

            Debug.Assert(designer != null, "Did not get designer for component");

            designer.InvokePropertyBuilder(DataGridComponentEditor.IDX_COLUMNS);
            return(value);
        }