private void pg_PropertyValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { PropertyItem item = e.OriginalSource as PropertyItem; switch (item.DisplayName) { case "ImageSource": { try { Uri u = new Uri(e.NewValue as string); BitmapImage bm = new BitmapImage(u); Value = new ImageBrush(bm); } catch (Exception) { } break; } case "Stretch": (Value as ImageBrush).Stretch = (Stretch)(e.NewValue); break; case "TileMode": (Value as ImageBrush).TileMode = (TileMode)(e.NewValue); break; case "Opacity": (Value as ImageBrush).Opacity = (double)(e.NewValue); break; } }
private void PropertyGrid_PropertyValueChanged(object sender, PropertyGrid.PropertyValueChangedEventArgs e) { if (_listBox != null) { _listBox.Items.Refresh(); } }
//Propertygrid'te yapılan her değişiklikte tetiklenecek private void propertyGrid_PropertyValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { SelectedPgrid = new PropertyGrid(); SelectedPgrid = (PropertyGrid)sender; string SelectedProperty = SelectedPgrid.SelectedProperty.ToString(); string newValue = e.NewValue.ToString(); Type ClassType = SelectedPgrid.SelectedObject.GetType(); Object ClassInstance = Activator.CreateInstance(ClassType); PropertyInfo StateNo = ClassType.GetProperty("StateNumber"); StateNo.SetValue(ClassInstance, SelectedPgrid.SelectedObjectName, null); object[] parametersArray = new object[] { SelectedProperty, newValue, ClassInstance, SelectedPgrid }; object result = ClassType.InvokeMember("StateChanged", BindingFlags.InvokeMethod, null, ClassInstance, parametersArray); this.TransactionDiagram.TransactionList.FindAll(x => x.TransactionName == this.TransactionDiagram.CurrentTransactionName).Find(x => x.Id == SelectedPgrid.SelectedObjectName).PropertyGrid.SelectedObject = result; propertyGrid.SelectedObject = result; // SelectedPgrid = new PropertyGrid(); // SelectedPgrid = (PropertyGrid)sender; // Object Obj = SelectedPgrid.SelectedObject; // this.TransactionDiagram.TransactionList.FindAll(x => x.TransactionName == this.TransactionDiagram.CurrentTransactionName). // Find(x => x.Id == SelectedPgrid.SelectedObjectName).PropertyGrid.SelectedObject = Obj; // propertyGrid.SelectedObject = Obj; }
private void PropertyGrid_PropertyValueChanged(object sender, PropertyGrid.PropertyValueChangedEventArgs e) { if (_listBox != null) { _listBox.Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() => { _listBox.Items.Refresh(); } )); } }
private async void propertyGrid_PropertyValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { PropertyItem item = e.OriginalSource as PropertyItem; //PropertyGrid嵌套PropertyGrid的情况,父PropertyGrid也会收到changed消息 //这里过滤子PropertyGrid的情况 MyPropertyDescriptor itemPropertyDescriptor = item.PropertyDescriptor as MyPropertyDescriptor; if (itemPropertyDescriptor == null) { return; } Type propertyType = item.PropertyType; object propertyValue = item.Value; var request = new SetPropertyRequest(); request.Path = VisualTree.SelectItemPath; request.PropertyID = itemPropertyDescriptor.MetaPropertyDescriptor.CppTypeID; request.PropertyType = itemPropertyDescriptor.MetaPropertyDescriptor.CppTypeName; request.PropertyValue = ValueToString(propertyValue); try { var s = Rpc._channel.State; var reply = await Rpc.NodeClient.SetPropertyAsync(request); if (!reply.Success) { ViewModel.LogData.Add(LogLevel.Error, reply.Msg); } } catch (Exception ex) { ViewModel.LogData.Add(LogLevel.Error, ex.Message); } ViewModel.LogData.Add(LogLevel.Info, "{0} changed to {1}", itemPropertyDescriptor.DisplayName, propertyValue); }
/// <summary> /// PropertyGrid only updates validation for the PropertyItem that was changed by default. This is a way to force it to update all properties in order to support dependencies. PropertyGrid is built for .NET 4 and does not support the ValidatesOnNotifyDataErrors binding property. /// </summary> private async void ConfigurationPropertyGrid_PropertyValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { var modifiedPropertyItem = e.OriginalSource as PropertyItem; if (modifiedPropertyItem != null) { await UpdateValidation(modifiedPropertyItem, true); } }
private void OnPropertyChanged(object sender, PropertyValueChangedEventArgs e) { var control = (UIElement)_propertyGrid.SelectedObject; control.InvalidateMeasure(); control.InvalidateVisual(); }
private void PgElementOnPropertyValueChanged(object sender, PropertyValueChangedEventArgs e) { var skinElement = (SkinElement) PgElement.SelectedObject; if (SkinController.SelectedWindow != null && SkinController.SelectedWindow.ColorPositions.Any(t => t.MapColor == Core.MapColor2Color(SkinController.SelectedElement.SkinElement.MapColor))) { var pos = SkinController.SelectedWindow.ColorPositions.First(t => t.MapColor == Core.MapColor2Color(SkinController.SelectedElement.SkinElement.MapColor)); switch (((PropertyItem) e.OriginalSource).DisplayName) { case "X": pos.X = (double) e.NewValue; break; case "Y": pos.Y = (double) e.NewValue; break; case "Width": pos.Width = (double) e.NewValue; break; case "Height": pos.Height = (double) e.NewValue; break; } } SkinController.DrawElement(skinElement); }