Zauważyłem pewien mankament w kodzie.
Nie ważne jak bym zmieniał wartość comboboxa, przy zmianie focusu na inną kontrolkę combobox przyjmuje wartość z momentu, kiedy był on zmapowany z obiektem.

 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        STObject obj;
        public Form1()
        {
            InitializeComponent();
            obj = new STObject();
            obj.Name = "ABC";
            obj.ControlType = STControlType.Button;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.DataBindings.Add("Text",obj,"ControlType");
        }
    }

    enum STControlType
    {
        TextBox = 0,
        RadioButton,
        Link,
        Button,
        ComboBox,
        CheckBox,
    }
    enum STPropertyType
    {
        Get = 1,
        Set,
        GetSet,
    }
    internal class STObject : INotifyPropertyChanged
    {
        private string name;
        private STControlType type;
        private STPropertyType propertyType;
        private string code;
        private string locatorName;

        public STObject()
        {
        }
        public void Copy(STObject obj)
        {
            this.Name = obj.name;
            this.PropertyType = obj.propertyType;
            this.Code = obj.code;
            this.LocatorName = obj.locatorName;
            this.ControlType = obj.ControlType;
        }
        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                this.NotifyPropertyChanged("Name");
            }
        }
        public string LocatorName
        {
            get { return locatorName; }
            set
            {
                locatorName = value;
                this.NotifyPropertyChanged("LocatorName");
            }
        }
        public STControlType ControlType
        {
            get { return type; }
            set
            {
                type = value;
                this.NotifyPropertyChanged("ControlType");
            }
        }
        public STPropertyType PropertyType
        {
            get { return propertyType; }
            set
            {
                propertyType = value;
                this.NotifyPropertyChanged("PropertyType");
            }
        }
        public string Code
        {
            get { return code; }
            set
            {
                code = value;
                this.NotifyPropertyChanged("Code");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string name)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(name));
        }
        public bool Equals(STObject obj)
        {
            if (this.LocatorName == obj.LocatorName && this.ControlType == obj.ControlType) return true;
            else return false;
        }
    }
}

Scenariusz:
Na comboboxie jest zaznaczona wartość button.

  1. Wybieramy inną wartość, np link
  2. Klikamy na inną kontrolkę na formatce, np Textbox
    Combobox przyjmuje wartość button...

Czy wynika to z pewnych cech, które nieświadomie zaimplementowałem?