public void Init(string visaAddr) { if (!string.IsNullOrEmpty(visaAddr)) { m_ConnectCtrlHandle = new ConnectCtrlHandle(visaAddr); iolibAddr = new IOLibAddr(); //初始化 CurrentVisaAddress = m_ConnectCtrlHandle.CurrentVisaAddress; //数据绑定 this.DataContext = this; #region 类型选择 //类型选择 this.comLanOrGpib.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Path = new PropertyPath("ConnectionTypeItems"), Source = this }); this.comLanOrGpib.SetBinding(ComboBox.SelectedItemProperty, new Binding() { Path = new PropertyPath("CurrentVisaAddress"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this }); #endregion } }
public void Init(string visaAddr) { m_ConnectCtrlHandle = new ConnectCtrlHandle(visaAddr); //初始化 CurrentVisaAddress = m_ConnectCtrlHandle.CurrentVisaAddress; //数据绑定 this.DataContext = this; #region 类型选择 //类型选择 this._cbConnectionTypeItems.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Path = new PropertyPath("ConnectionTypeItems"), Source = this }); this._cbConnectionTypeItems.SetBinding(ComboBox.SelectedItemProperty, new Binding() { Path = new PropertyPath("CurrentVisaAddress"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this }); #endregion }