void button_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; BufferPositions bufferPopup = new BufferPositions(btn.Content.ToString()); bufferPopup.ShowDialog(); btn.Content = bufferPopup.BufferPositionValue; var Selection = designerCanvas.SelectionService.CurrentSelection; ViewModelDesignerItem Ditem = new ViewModelDesignerItem(); foreach (var slc in Selection) { Ditem = (ViewModelDesignerItem)slc; } DockPanel Sourcepnl = (DockPanel)Ditem.Content; PropertyGrid SelectedPgrid = designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == Sourcepnl.Uid).PropertyGrid; string SelectedProperty = btn.Name.ToString(); string newValue = btn.Content.ToString(); StateY statey = (StateY)SelectedPgrid.SelectedObject; Type ClassType = statey.GetType(); PropertyInfo property = ClassType.GetProperty(SelectedProperty); property.SetValue(statey, newValue, null); designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == Sourcepnl.Uid).PropertyGrid.SelectedObject = statey; }
void ccb_ItemSelectionChanged(object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e) { Xceed.Wpf.Toolkit.CheckComboBox ccb = (Xceed.Wpf.Toolkit.CheckComboBox)sender; int mask = 0; foreach (var item in ccb.SelectedItems) { double index = Convert.ToDouble(item.ToString().Substring(6)); mask = mask + (int)Math.Pow(2, index); } ccb.Text = mask.ToString("000"); var Selection = designerCanvas.SelectionService.CurrentSelection; ViewModelDesignerItem Ditem = new ViewModelDesignerItem(); foreach (var slc in Selection) { Ditem = (ViewModelDesignerItem)slc; } DockPanel Sourcepnl = (DockPanel)Ditem.Content; PropertyGrid SelectedPgrid = designerCanvas.TransactionList.Find(x => x.Id == Sourcepnl.Uid).PropertyGrid; string SelectedProperty = property.DisplayName; string newValue = ccb.Text; StateY stated = (StateY)SelectedPgrid.SelectedObject; Type ClassType = stated.GetType(); PropertyInfo propertyName = ClassType.GetProperty(SelectedProperty); propertyName.SetValue(stated, newValue, null); designerCanvas.TransactionList.Find(x => x.Id == Sourcepnl.Uid).PropertyGrid.SelectedObject = stated; }