Ejemplo n.º 1
0
        private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox          listBox          = sender as ListBox;
            KeyValueProperty keyValueProperty = this.panel3.Controls["_keyvalueProperty"] as KeyValueProperty;

            LibKeyValue keyValue = listBox.Items[listBox.SelectedIndex] as LibKeyValue;

            keyValueProperty.SetPropertyValue(keyValue, null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增项事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button1_Click(object sender, EventArgs e)
        {
            LibKeyValue keyValue = new LibKeyValue();

            keyValue.ID    = Guid.NewGuid().ToString();
            keyValue.Key   = string.Format("itemkey{0}", this.listBox1.Items.Count + 1);
            keyValue.Value = string.Format("itemvalue{0}", this.listBox1.Items.Count + 1);

            this.listBox1.Items.Add(keyValue);
            this.listBox1.SelectedItem = keyValue;
            KeyValueProperty keyValueProperty = this.panel3.Controls["_keyvalueProperty"] as KeyValueProperty;

            keyValueProperty.SetPropertyValue(keyValue, null);
        }
Ejemplo n.º 3
0
        public void GetControlValueBindToKeyValue()
        {
            if (this._keyvalus.KeyValues == null)
            {
                this._keyvalus.KeyValues = new SDPCRL.CORE.LibCollection <LibKeyValue>();
            }
            LibKeyValue exist = null;

            foreach (LibKeyValue item in this.listBox1.Items)
            {
                exist = this._keyvalus.KeyValues.FindFirst("Key", item.Key);
                if (exist == null)
                {
                    this._keyvalus.KeyValues.Add(item);
                }
            }
        }
Ejemplo n.º 4
0
        private void ListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox          listBox          = sender as ListBox;
            Control          container        = listBox.Parent;
            KeyValueProperty keyValueProperty = container.Controls["_keyvalueProperty"] as KeyValueProperty;

            LibKeyValue keyValue = listBox.Items[listBox.SelectedIndex] as LibKeyValue;

            keyValueProperty.SetPropertyValue(keyValue, null);
            if (!string.IsNullOrEmpty(keyValue.FromkeyValueID))
            {
                keyValueProperty.Enabled = false;
            }
            else
            {
                keyValueProperty.Enabled = true;
            }
        }
Ejemplo n.º 5
0
        /// <summary>键值对窗体中的添加按钮事件</summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Addbtn_Click(object sender, EventArgs e)
        {
            Control     ctl       = sender as Control;
            Control     container = ctl.Parent.Parent;
            ListBox     box       = container.Controls["_listbox"] as ListBox;
            LibKeyValue keyValue  = new LibKeyValue();

            keyValue.ID    = Guid.NewGuid().ToString();
            keyValue.Key   = string.Format("itemkey{0}", box.Items.Count + 1);
            keyValue.Value = string.Format("itemvalue{0}", box.Items.Count + 1);

            box.Items.Add(keyValue);

            //KeyValueProperty keyValueProperty = new KeyValueProperty();
            //keyValueProperty.Dock = DockStyle.Fill;
            KeyValueProperty keyValueProperty = container.Controls["_keyvalueProperty"] as KeyValueProperty;

            keyValueProperty.SetPropertyValue(keyValue, null);

            //container.Controls["keyvalueContains"].Controls.Add(keyValueProperty);
        }