void button_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; FDKPriorityApp fdkpopup = new FDKPriorityApp(btn.Content.ToString()); fdkpopup.ShowDialog(); btn.Content = fdkpopup.FDKValue; 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 = btn.Name.ToString(); string newValue = btn.Content.ToString(); Statee001 state = (Statee001)SelectedPgrid.SelectedObject; Type ClassType = state.GetType(); PropertyInfo property = ClassType.GetProperty(SelectedProperty); property.SetValue(state, newValue, null); designerCanvas.TransactionList.Find(x => x.Id == Sourcepnl.Uid).PropertyGrid.SelectedObject = state; }