示例#1
0
 private void AxisComboBox_SelectedIndexChanged(object sender, RoutedEventArgs e)
 {
     Allpanel.Children.Clear();
     foreach (DataColumn column in dt.Columns)
     {
         if (column.ColumnName.ToUpper() != "Y" && column.ColumnName.ToString() != AxisComboBox.SelectedItem.ToString())
         {
             TraceEditValue traceEditValue = new TraceEditValue()
             {
                 DisplayName = column.ColumnName
             };
             StackPanel panel = new StackPanel()
             {
                 Orientation = Orientation.Vertical
             };
             Label lable = new Label()
             {
                 Content = column.ColumnName
             };
             ComboBoxEdit comboBoxEdit = new ComboBoxEdit()
             {
                 Width             = 150, Height = 25, HorizontalAlignment = HorizontalAlignment.Left,
                 VerticalAlignment = VerticalAlignment.Center, PopupFooterButtons = PopupFooterButtons.None, ImmediatePopup = true, Tag = column.ColumnName.ToString()
             };
             comboBoxEdit.StyleSettings     = new CheckedComboBoxStyleSettings();
             comboBoxEdit.PopupClosing     += comb_PopupClosing;
             comboBoxEdit.PopupOpening     += comb_PopupOpening;
             comboBoxEdit.EditValueChanged += comb_EditValueChanged;
             foreach (DataRow row in dt.Rows)
             {
                 if (!traceEditValue.EditValuelist.Contains((row[column.ColumnName])))
                 {
                     traceEditValue.EditValuelist.Add((row[column.ColumnName]));
                 }
             }
             comboBoxEdit.ItemsSource = traceEditValue.EditValuelist;
             panel.Children.Add(lable);
             panel.Children.Add(comboBoxEdit);
             Allpanel.Children.Add(panel);
         }
     }
 }
示例#2
0
        private void comb_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
        {
            List <object> listitem = (sender as ComboBoxEdit).EditValue as List <object>;

            if (listitem == null)
            {
                return;
            }
            for (int i = 0; i < listitem.Count(); i++)
            {
                if (listitem[i].GetType() == typeof(DevExpress.Xpf.Editors.SelectAllItem))
                {
                    listitem.RemoveAt(i);
                }
            }
            string str        = (sender as ComboBoxEdit).Tag.ToString();
            var    TraceValue = EditTraceValuelist.Find(x => x.DisplayName == str);

            if (TraceValue != null)
            {
                TraceValue.EditValuelist.Clear();
                foreach (var item in listitem)
                {
                    TraceValue.EditValuelist.Add(item);
                }
            }
            else
            {
                TraceEditValue editValue = new TraceEditValue()
                {
                    DisplayName = str
                };
                EditTraceValuelist.Add(editValue);
                foreach (var item in listitem)
                {
                    editValue.EditValuelist.Add(item);
                }
            }
        }