Example #1
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (((provider != null) && (context != null)) && (context.Instance != null))
     {
         PropertyDescriptor descriptor = TypeDescriptor.GetProperties(context.Instance)["LinkedDataSource"];
         if (descriptor == null)
         {
             return(value);
         }
         object rootDataSource = descriptor.GetValue(context.Instance);
         if (rootDataSource == null)
         {
             return(value);
         }
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(null, (string)value);
         DesignBinding binding2            = this.designBindingPicker.Pick(context, provider, false, true, false, rootDataSource, string.Empty, initialSelectedItem);
         if (binding2 != null)
         {
             value = binding2.DataMember;
         }
     }
     return(value);
 }
Example #2
0
        private void DropDownPicker()
        {
            if (this.designBindingPicker == null)
            {
                this.designBindingPicker       = new DesignBindingPicker();
                this.designBindingPicker.Width = base.Width;
            }
            DesignBinding initialSelectedItem = null;

            if (this.binding != null)
            {
                initialSelectedItem = new DesignBinding(this.binding.DataSource, this.binding.BindingMemberInfo.BindingMember);
            }
            DesignBinding binding2 = this.designBindingPicker.Pick(this, this, true, true, false, null, string.Empty, initialSelectedItem);

            if (binding2 != null)
            {
                System.Windows.Forms.Binding binding      = this.binding;
                System.Windows.Forms.Binding binding4     = null;
                string               formatString         = (binding != null) ? binding.FormatString : string.Empty;
                IFormatProvider      formatInfo           = (binding != null) ? binding.FormatInfo : null;
                object               nullValue            = (binding != null) ? binding.NullValue : null;
                DataSourceUpdateMode dataSourceUpdateMode = (binding != null) ? binding.DataSourceUpdateMode : this.defaultDataSourceUpdateMode;
                if ((binding2.DataSource != null) && !string.IsNullOrEmpty(binding2.DataMember))
                {
                    binding4 = new System.Windows.Forms.Binding(this.propertyName, binding2.DataSource, binding2.DataMember, true, dataSourceUpdateMode, nullValue, formatString, formatInfo);
                }
                this.Binding = binding4;
                if ((((binding4 == null) || (binding != null)) || ((binding4 != null) && (binding == null))) || (((binding4 != null) && (binding != null)) && ((binding4.DataSource != binding.DataSource) || !binding4.BindingMemberInfo.Equals(binding.BindingMemberInfo))))
                {
                    this.OnPropertyValueChanged(EventArgs.Empty);
                }
            }
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (edSvc != null && context.Instance != null)
                {
                    if (designBindingPicker == null)
                    {
                        designBindingPicker = new DesignBindingPicker(context, /*multiple DataSources*/ false, /*select lists*/ false);
                    }
                    PropertyDescriptor dataSourceProperty = TypeDescriptor.GetProperties(context.Instance)["LinkedDataSource"];
                    if (dataSourceProperty != null)
                    {
                        object dataSource = dataSourceProperty.GetValue(context.Instance);
                        if (dataSource != null)
                        {
                            designBindingPicker.Start(context, edSvc, dataSource, new DesignBinding(null, (string)value));
                            edSvc.DropDownControl(designBindingPicker);
                            if (designBindingPicker.SelectedItem != null)
                            {
                                value = designBindingPicker.SelectedItem.DataMember;
                            }
                            designBindingPicker.End();
                        }
                    }
                }
            }

            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (((provider != null) && (context != null)) && (context.Instance != null))
     {
         DataGridColumnStyle instance = (DataGridColumnStyle) context.Instance;
         if ((instance.DataGridTableStyle == null) || (instance.DataGridTableStyle.DataGrid == null))
         {
             return value;
         }
         PropertyDescriptor descriptor = TypeDescriptor.GetProperties(instance.DataGridTableStyle.DataGrid)["DataSource"];
         if (descriptor == null)
         {
             return value;
         }
         object rootDataSource = descriptor.GetValue(instance.DataGridTableStyle.DataGrid);
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(null, (string) value);
         DesignBinding binding2 = this.designBindingPicker.Pick(context, provider, false, true, false, rootDataSource, string.Empty, initialSelectedItem);
         if ((rootDataSource == null) || (binding2 == null))
         {
             return value;
         }
         if (string.IsNullOrEmpty(binding2.DataMember) || (binding2.DataMember == null))
         {
             value = "";
             return value;
         }
         value = binding2.DataField;
     }
     return value;
 }
Example #5
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null && context != null && context.Instance != null)
     {
         DataGridTableStyle dataGridTableStyle = (DataGridTableStyle)context.Instance;
         if (dataGridTableStyle.DataGrid == null)
         {
             return(value);
         }
         PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(dataGridTableStyle.DataGrid)["DataSource"];
         if (propertyDescriptor != null)
         {
             object value2 = propertyDescriptor.GetValue(dataGridTableStyle.DataGrid);
             if (designBindingPicker == null)
             {
                 designBindingPicker = new DesignBindingPicker();
             }
             DesignBinding initialSelectedItem = new DesignBinding(value2, (string)value);
             DesignBinding designBinding       = designBindingPicker.Pick(context, provider, showDataSources: false, showDataMembers: true, selectListMembers: true, value2, string.Empty, initialSelectedItem);
             if (value2 != null && designBinding != null)
             {
                 value = ((!string.IsNullOrEmpty(designBinding.DataMember) && designBinding.DataMember != null) ? designBinding.DataField : "");
             }
         }
     }
     return(value);
 }
Example #6
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (((provider != null) && (context != null)) && (context.Instance != null))
     {
         DataGridColumnStyle instance = (DataGridColumnStyle)context.Instance;
         if ((instance.DataGridTableStyle == null) || (instance.DataGridTableStyle.DataGrid == null))
         {
             return(value);
         }
         PropertyDescriptor descriptor = TypeDescriptor.GetProperties(instance.DataGridTableStyle.DataGrid)["DataSource"];
         if (descriptor == null)
         {
             return(value);
         }
         object rootDataSource = descriptor.GetValue(instance.DataGridTableStyle.DataGrid);
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(null, (string)value);
         DesignBinding binding2            = this.designBindingPicker.Pick(context, provider, false, true, false, rootDataSource, string.Empty, initialSelectedItem);
         if ((rootDataSource == null) || (binding2 == null))
         {
             return(value);
         }
         if (string.IsNullOrEmpty(binding2.DataMember) || (binding2.DataMember == null))
         {
             value = "";
             return(value);
         }
         value = binding2.DataField;
     }
     return(value);
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (((provider != null) && (context != null)) && (context.Instance != null))
     {
         PropertyDescriptor descriptor = TypeDescriptor.GetProperties(context.Instance)["LinkedDataSource"];
         if (descriptor == null)
         {
             return value;
         }
         object rootDataSource = descriptor.GetValue(context.Instance);
         if (rootDataSource == null)
         {
             return value;
         }
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(null, (string) value);
         DesignBinding binding2 = this.designBindingPicker.Pick(context, provider, false, true, false, rootDataSource, string.Empty, initialSelectedItem);
         if (binding2 != null)
         {
             value = binding2.DataMember;
         }
     }
     return value;
 }
Example #8
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         value = this.designBindingPicker.Pick(context, provider, true, true, false, null, string.Empty, (DesignBinding)value);
     }
     return(value);
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         value = this.designBindingPicker.Pick(context, provider, true, true, false, null, string.Empty, (DesignBinding) value);
     }
     return value;
 }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (edSvc != null && context.Instance != null)
                {
                    if (designBindingPicker == null)
                    {
                        designBindingPicker = new DesignBindingPicker(context, /*multiple DataSources*/ false, /*select lists*/ true);
                    }
                    object             instance   = context.Instance;
                    DataGridTableStyle tableStyle = (DataGridTableStyle)context.Instance;
                    if (tableStyle.DataGrid == null)
                    {
                        return(value);
                    }
                    PropertyDescriptor dataSourceProperty = TypeDescriptor.GetProperties(tableStyle.DataGrid)["DataSource"];
                    if (dataSourceProperty != null)
                    {
                        object dataSource = dataSourceProperty.GetValue(tableStyle.DataGrid);
                        if (dataSource != null)
                        {
                            designBindingPicker.Start(context, edSvc, dataSource, new DesignBinding(dataSource, (string)value));
                            edSvc.DropDownControl(designBindingPicker);
                            if (designBindingPicker.SelectedItem != null)
                            {
                                if (String.Empty.Equals(designBindingPicker.SelectedItem.DataMember) || designBindingPicker.SelectedItem.DataMember == null)
                                {
                                    value = "";
                                }
                                else
                                {
                                    value = designBindingPicker.SelectedItem.DataField;
                                }
                            }
                            designBindingPicker.End();
                        }
                        else
                        {
                            // ASURT 61510: do not throw the exception ( the exception was added in bug 37841 )
                            designBindingPicker.Start(context, edSvc, dataSource, new DesignBinding(null, (string)value));
                            edSvc.DropDownControl(designBindingPicker);
                            designBindingPicker.End();
                        }
                    }
                }
            }

            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (((provider != null) && (context != null)) && (context.Instance != null))
     {
         DataGridView dataGridView;
         DataGridViewColumnCollectionDialog.ListBoxItem instance = context.Instance as DataGridViewColumnCollectionDialog.ListBoxItem;
         if (instance != null)
         {
             dataGridView = instance.DataGridViewColumn.DataGridView;
         }
         else
         {
             DataGridViewColumn column = context.Instance as DataGridViewColumn;
             if (column != null)
             {
                 dataGridView = column.DataGridView;
             }
             else
             {
                 dataGridView = null;
             }
         }
         if (dataGridView == null)
         {
             return value;
         }
         object dataSource = dataGridView.DataSource;
         string dataMember = dataGridView.DataMember;
         string str2 = (string) value;
         string str3 = dataMember + "." + str2;
         if (dataSource == null)
         {
             dataMember = string.Empty;
             str3 = str2;
         }
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(dataSource, str3);
         DesignBinding binding2 = this.designBindingPicker.Pick(context, provider, false, true, false, dataSource, dataMember, initialSelectedItem);
         if ((dataSource != null) && (binding2 != null))
         {
             value = binding2.DataField;
         }
     }
     return value;
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (((provider != null) && (context != null)) && (context.Instance != null))
     {
         DataGridView dataGridView;
         DataGridViewColumnCollectionDialog.ListBoxItem instance = context.Instance as DataGridViewColumnCollectionDialog.ListBoxItem;
         if (instance != null)
         {
             dataGridView = instance.DataGridViewColumn.DataGridView;
         }
         else
         {
             DataGridViewColumn column = context.Instance as DataGridViewColumn;
             if (column != null)
             {
                 dataGridView = column.DataGridView;
             }
             else
             {
                 dataGridView = null;
             }
         }
         if (dataGridView == null)
         {
             return(value);
         }
         object dataSource = dataGridView.DataSource;
         string dataMember = dataGridView.DataMember;
         string str2       = (string)value;
         string str3       = dataMember + "." + str2;
         if (dataSource == null)
         {
             dataMember = string.Empty;
             str3       = str2;
         }
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(dataSource, str3);
         DesignBinding binding2            = this.designBindingPicker.Pick(context, provider, false, true, false, dataSource, dataMember, initialSelectedItem);
         if ((dataSource != null) && (binding2 != null))
         {
             value = binding2.DataField;
         }
     }
     return(value);
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if ((provider != null) && (context.Instance != null))
     {
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(value, "");
         DesignBinding binding2 = this.designBindingPicker.Pick(context, provider, true, false, false, null, string.Empty, initialSelectedItem);
         if (binding2 != null)
         {
             value = binding2.DataSource;
         }
     }
     return value;
 }
Example #14
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if ((provider != null) && (context.Instance != null))
     {
         if (this.designBindingPicker == null)
         {
             this.designBindingPicker = new DesignBindingPicker();
         }
         DesignBinding initialSelectedItem = new DesignBinding(value, "");
         DesignBinding binding2            = this.designBindingPicker.Pick(context, provider, true, false, false, null, string.Empty, initialSelectedItem);
         if (binding2 != null)
         {
             value = binding2.DataSource;
         }
     }
     return(value);
 }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (edSvc != null)
                {
                    if (designBindingPicker == null)
                    {
                        designBindingPicker = new DesignBindingPicker(context, /*multiple DataSources*/ true, /*select lists*/ false);
                    }
                    designBindingPicker.Start(context, edSvc, null, (DesignBinding)value);
                    edSvc.DropDownControl(designBindingPicker);
                    value = designBindingPicker.SelectedItem;
                    designBindingPicker.End();
                }
            }

            return(value);
        }
 public DataSourceNode(DesignBindingPicker picker, object dataSource, string nodeName) : base(picker, nodeName)
 {
     this.dataSource = dataSource;
     base.BindingImageIndex = (int) DesignBindingPicker.BindingPickerNode.BindingImageIndexForDataSource(dataSource);
 }
 private void DropDownPicker()
 {
     if (this.designBindingPicker == null)
     {
         this.designBindingPicker = new DesignBindingPicker();
         this.designBindingPicker.Width = base.Width;
     }
     DesignBinding initialSelectedItem = null;
     if (this.binding != null)
     {
         initialSelectedItem = new DesignBinding(this.binding.DataSource, this.binding.BindingMemberInfo.BindingMember);
     }
     DesignBinding binding2 = this.designBindingPicker.Pick(this, this, true, true, false, null, string.Empty, initialSelectedItem);
     if (binding2 != null)
     {
         System.Windows.Forms.Binding binding = this.binding;
         System.Windows.Forms.Binding binding4 = null;
         string formatString = (binding != null) ? binding.FormatString : string.Empty;
         IFormatProvider formatInfo = (binding != null) ? binding.FormatInfo : null;
         object nullValue = (binding != null) ? binding.NullValue : null;
         DataSourceUpdateMode dataSourceUpdateMode = (binding != null) ? binding.DataSourceUpdateMode : this.defaultDataSourceUpdateMode;
         if ((binding2.DataSource != null) && !string.IsNullOrEmpty(binding2.DataMember))
         {
             binding4 = new System.Windows.Forms.Binding(this.propertyName, binding2.DataSource, binding2.DataMember, true, dataSourceUpdateMode, nullValue, formatString, formatInfo);
         }
         this.Binding = binding4;
         if ((((binding4 == null) || (binding != null)) || ((binding4 != null) && (binding == null))) || (((binding4 != null) && (binding != null)) && ((binding4.DataSource != binding.DataSource) || !binding4.BindingMemberInfo.Equals(binding.BindingMemberInfo))))
         {
             this.OnPropertyValueChanged(EventArgs.Empty);
         }
     }
 }
 public ProjectDataMemberNode(DesignBindingPicker picker, object dataSource, string dataMember, string dataField, bool isList) : base(picker, dataSource, dataMember, dataField, isList)
 {
 }
 public DataMemberNode(DesignBindingPicker picker, object dataSource, string dataMember, string dataField, bool isList) : base(picker, dataSource, dataField)
 {
     this.dataMember = dataMember;
     this.isList = isList;
     base.BindingImageIndex = isList ? 5 : 6;
 }
 public BindingPickerNode(DesignBindingPicker picker, string nodeName, BindingImage index) : base(nodeName)
 {
     this.picker = picker;
     this.BindingImageIndex = (int) index;
 }
 public BindingPickerNode(DesignBindingPicker picker, string nodeName) : base(nodeName)
 {
     this.picker = picker;
 }
 public ProjectNode(DesignBindingPicker picker) : base(picker, System.Design.SR.GetString("DesignBindingPickerNodeProject"), DesignBindingPicker.BindingPickerNode.BindingImage.Project)
 {
 }
 public ProjectGroupNode(DesignBindingPicker picker, string nodeName, Image image) : base(picker, nodeName, DesignBindingPicker.BindingPickerNode.BindingImage.Project)
 {
     if (image != null)
     {
         base.CustomBindingImage = image;
     }
 }
 public ProjectDataSourceNode(DesignBindingPicker picker, object dataSource, string nodeName, Image image) : base(picker, dataSource, nodeName)
 {
     if (image != null)
     {
         base.CustomBindingImage = image;
     }
 }