Ejemplo n.º 1
0
        protected override void DeactivateControlCore(Control control, Cell cell)
        {
            MyOptionPicker c = control as MyOptionPicker;

            for (int i = 0; i < this.TemplateControl.DropDownControl.Columns.Count; ++i)
            {
                this.TemplateControl.DropDownControl.Columns[i].Width = c.DropDownControl.Columns[i].Width;
            }

            base.DeactivateControlCore(control, cell);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// CreateControl
        /// </summary>
        /// <returns></returns>
        protected override Control CreateControl()
        {
            MyOptionPicker ret = this.TemplateControl.Clone() as MyOptionPicker;

            for (int i = 0; i < this.TemplateControl.DropDownControl.Columns.Count; ++i)
            {
                ret.DropDownControl.Columns[i].Visible  = this.TemplateControl.DropDownControl.Columns[i].Visible;
                ret.DropDownControl.Columns[i].ReadOnly = this.TemplateControl.DropDownControl.Columns[i].ReadOnly;
                //ret.DropDownControl.Columns[i].Width = this.TemplateControl.DropDownControl.Columns[i].Width;
            }
            for (int i = 0; i < this.TemplateControl.DropDownControl.DataRows.Count; ++i)
            {
                ret.DropDownControl.DataRows[i].Visible  = this.TemplateControl.DropDownControl.DataRows[i].Visible;
                ret.DropDownControl.DataRows[i].ReadOnly = this.TemplateControl.DropDownControl.DataRows[i].ReadOnly;
                ret.DropDownControl.DataRows[i].Height   = this.TemplateControl.DropDownControl.DataRows[i].Height;
            }
            return(ret);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="control"></param>
        /// <param name="cell"></param>
        protected override void SetControlValueCore(Control control, Cell cell)
        {
            MyOptionPicker box  = control as MyOptionPicker;
            object         obj2 = cell.Value;

            if (((obj2 == null) || (obj2 == DBNull.Value)) || obj2.Equals(cell.NullValue))
            {
                box.SelectedDataValue   = null;
                box.TextBoxArea.RawText = string.Empty;
            }
            else if (string.IsNullOrEmpty(box.ValueMember))
            {
                box.SelectedDataValue   = null;
                box.TextBoxArea.RawText = (string)Convert.ChangeType(obj2, typeof(string), cell.FormatProvider);
            }
            else
            {
                //Column column = box.DropDownControl.Columns[box.ValueMember];
                //if ((column != null) && (column.DataType != typeof (object)))
                //{
                //    System.Type dataType = column.DataType;
                //    System.Type underlyingType = Nullable.GetUnderlyingType(dataType);
                //    if (underlyingType != null)
                //    {
                //        dataType = underlyingType;
                //    }
                //    box.SelectedDataValue = Convert.ChangeType(obj2, dataType, cell.FormatProvider);
                //}
                //else
                {
                    box.SelectedDataValue = obj2.ToString();
                }
                if ((box.SelectedDataValue == null))
                {
                    box.TextBoxArea.RawText = (string)Convert.ChangeType(obj2, typeof(string), cell.FormatProvider);
                }
            }
        }
Ejemplo n.º 4
0
        //internal static void CommonSetControlAppearance(WinComboBox control, Cell cell)
        //{
        //    TextEditor.CommonSetControlAppearance(control, cell);
        //}

        /// <summary>
        ///
        /// </summary>
        /// <param name="control"></param>
        /// <param name="cell"></param>
        /// <param name="returnDataType"></param>
        /// <returns></returns>
        protected override object GetControlValueCore(Control control, Cell cell, System.Type returnDataType)
        {
            MyOptionPicker box = control as MyOptionPicker;

            if (box.SelectedDataValue == null)
            {
                return(cell.NullValue);
            }
            System.Type underlyingType = Nullable.GetUnderlyingType(returnDataType);
            if (underlyingType != null)
            {
                returnDataType = underlyingType;
            }
            if (string.IsNullOrEmpty(box.ValueMember))
            {
                return(Convert.ChangeType(box.TextBoxArea.RawText, returnDataType, cell.FormatProvider));
            }
            if (returnDataType != typeof(object))
            {
                return(Convert.ChangeType(box.SelectedDataValue, returnDataType, cell.FormatProvider));
            }
            return(box.SelectedDataValue);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="template"></param>
 protected MyOptionPickerEditor(MyOptionPicker template)
     : base(template)
 {
 }