public FrameworkElement ResolveEditor(PropertyItem propertyItem) { var editor = new ButtonEdit(); var button = new ButtonInfo {GlyphKind = GlyphKind.User }; button.Click += (s, e) => OnCopyValue(editor); button.Content = new Image { Source = Properties.Resources.Clipboard.ToBitmapImage(), Width = 16, Height = 16, Stretch = Stretch.Uniform }; editor.Buttons.Add(button); editor.AllowDefaultButton = false; editor.ShowBorder = false; editor.IsReadOnly = false; editor.Mask = GetDisplayFormat(propertyItem); editor.MaskType = GetMaskType(propertyItem); editor.MaskUseAsDisplayFormat = true; editor.EditMode = EditMode.Standalone; editor.Background = Brushes.Transparent; editor.TextWrapping = TextWrapping.NoWrap; editor.TextTrimming = TextTrimming.WordEllipsis; var binding = new Binding("Value"); binding.Source = propertyItem; binding.ValidatesOnExceptions = true; binding.ValidatesOnDataErrors = true; binding.Mode = BindingMode.OneWay; BindingOperations.SetBinding(editor, BaseEdit.EditValueProperty, binding); return editor; }
protected override IEnumerable CreateItemsSource(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { return(new string[1] { CustomValueConverter <T> .Null } .Concat(Enum.GetValues(typeof(T)).OfType <T>().Select(x => x.ToString()))); }
FrameworkElement ITypeEditor.ResolveEditor(PropertyItem propertyItem) { SetBinding(SelectedColumnsProperty, new Binding("Value") { Source = propertyItem, Mode = BindingMode.TwoWay }); ColumnsPicker.SetBinding(DdeColumnsPicker.SelectedColumnsProperty, new Binding("SelectedColumns") { Source = this, Mode = BindingMode.TwoWay }); return this; }
private void bind(PropertyItem propertyItem, RadioButton btnTopLeft, Anchor anchor) { BindingOperations.SetBinding(btnTopLeft, ToggleButton.IsCheckedProperty, LambdaBinding.New( new Binding("Value") { Source = propertyItem, Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay }, (object source) => { return (Anchor) source == anchor; }, (bool source) => { return source ? anchor : Binding.DoNothing; } )); }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { Binding binding = new Binding("Value"); binding.Source = propertyItem; binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(this, ImagePathEditor.ValueProperty, binding); return this; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { Loaded += (s, e) => { DataContext = propertyItem; }; return this; }
private string GetDisplayFormat(PropertyItem propertyItem) { if (propertyItem.Value is DateTime) { return HeaderInfo.MessageDateFormat; } return null; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { BindingOperations.SetBinding(ctCombo, ComboBox.SelectedItemProperty, LambdaBinding.New( new Binding("Value") { Source = propertyItem, Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay }, (ExtraPropertyId source) => { return App.DataSources.FirstOrDefault(d => d.PropertyId.Equals(source)); }, (DataSourceInfo source) => { return source == null ? null : source.PropertyId; } )); return this; }
private MaskType GetMaskType(PropertyItem propertyItem) { if (propertyItem.Value is DateTime) { return MaskType.DateTime; } return MaskType.None; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { property = propertyItem; Button button = new Button(); button.Name = property.DisplayName; button.Content = property.Value; button.Click += button_Click; return(button); }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { Binding binding = new Binding("Value"); binding.Source = propertyItem; binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(this, ScenarioFilePathEditor.ValueProperty, binding); if (propertyItem.IsReadOnly) { ButtonSelect.IsEnabled = false; } return this; }
FrameworkElement ITypeEditor.ResolveEditor(PropertyItem propertyItem) { BindingOperations.SetBinding(this, EndPointsProperty, new Binding("Value") { Source = propertyItem, ValidatesOnExceptions = true, ValidatesOnDataErrors = true, Mode = BindingMode.TwoWay }); return this; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { bind(propertyItem, btnTopLeft, Anchor.TopLeft); bind(propertyItem, btnTopCenter, Anchor.TopCenter); bind(propertyItem, btnTopRight, Anchor.TopRight); bind(propertyItem, btnMidLeft, Anchor.MidLeft); bind(propertyItem, btnMidCenter, Anchor.MidCenter); bind(propertyItem, btnMidRight, Anchor.MidRight); bind(propertyItem, btnBottomLeft, Anchor.BottomLeft); bind(propertyItem, btnBottomCenter, Anchor.BottomCenter); bind(propertyItem, btnBottomRight, Anchor.BottomRight); return this; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { property = propertyItem; Xceed.Wpf.Toolkit.CheckComboBox ccb = new Xceed.Wpf.Toolkit.CheckComboBox(); for (int i = 0; i < 8; i++) { ccb.Items.Add("OpCode" + i.ToString()); } ccb.Name = property.DisplayName; ccb.Text = property.Value.ToString(); ccb.ItemSelectionChanged += ccb_ItemSelectionChanged; return(ccb); }
FrameworkElement ITypeEditor.ResolveEditor(PropertyItem propertyItem) { var comboBox = new RssAddressComboBox { IsEditable = true, Width = double.NaN }; var binding = new Binding("Value") { Source = propertyItem, Converter = new UriValueConverter(comboBox, comboBox.SelectedAddress), Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay }; BindingOperations.SetBinding(comboBox, ComboBox.TextProperty, binding); return comboBox; }
FrameworkElement ITypeEditor.ResolveEditor(PropertyItem propertyItem) { var comboBox = new AmazonRegionComboBox { IsEditable = false, Width = double.NaN }; var binding = new Binding("Value") { Source = propertyItem, //Converter = new EndPointValueConverter(comboBox, SmartComAddresses.Matrix), Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay }; BindingOperations.SetBinding(comboBox, ComboBox.TextProperty, binding); return comboBox; }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { // propertyItem.DragOver += new DragEventHandler(test); propertyItem.PreviewDragOver += new DragEventHandler(dragOver); propertyItem.PreviewDrop += new DragEventHandler(drop); propertyItem.PreviewDragLeave += new DragEventHandler(dragleave); Binding binding = new Binding("PathValue"); binding.Source = propertyItem; binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(this, AssetFilePathEditor.PathValueProperty, binding); return(this); }
FrameworkElement ITypeEditor.ResolveEditor(PropertyItem propertyItem) { var type = ((DdeTable)propertyItem.Value).Type; switch (type) { case DdeTableTypes.Security: ColumnsPicker.DdeColumns = typeof(DdeSecurityColumns); break; case DdeTableTypes.Order: ColumnsPicker.DdeColumns = typeof(DdeOrderColumns); break; case DdeTableTypes.StopOrder: ColumnsPicker.DdeColumns = typeof(DdeStopOrderColumns); break; case DdeTableTypes.Trade: ColumnsPicker.DdeColumns = typeof(DdeTradeColumns); break; case DdeTableTypes.MyTrade: ColumnsPicker.DdeColumns = typeof(DdeMyTradeColumns); break; case DdeTableTypes.Quote: ColumnsPicker.DdeColumns = typeof(DdeQuoteColumns); break; case DdeTableTypes.EquityPosition: ColumnsPicker.DdeColumns = typeof(DdeEquityPositionColumns); break; case DdeTableTypes.DerivativePosition: ColumnsPicker.DdeColumns = typeof(DdeDerivativePositionColumns); break; case DdeTableTypes.EquityPortfolio: ColumnsPicker.DdeColumns = typeof(DdeEquityPortfolioColumns); break; case DdeTableTypes.DerivativePortfolio: ColumnsPicker.DdeColumns = typeof(DdeDerivativePortfolioColumns); break; case DdeTableTypes.CurrencyPortfolio: ColumnsPicker.DdeColumns = typeof(DdeCurrencyPortfolioColumns); break; default: throw new ArgumentOutOfRangeException(); } this.SetBindings(SelectedColumnsProperty, propertyItem, "Value.Columns", BindingMode.OneWay); ColumnsPicker.SetBindings(DdeTableColumnsPicker.SelectedColumnsProperty, propertyItem, "Value.Columns", BindingMode.OneWay); return this; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { ComboBox options = new ComboBox(); var source = GetOptions().ToList(); options.ItemsSource = source; options.SelectedItem = source.First(); var a = options.SelectedItem; //create the binding from the bound property item to the editor var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(options, ComboBox.SelectedItemProperty, _binding); return options; }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { var component = propertyItem.Value as ComponentX; if (component == null) { return(this); } ctxMenu.ItemsSource = component.MenuOptions; Binding binding = new Binding("Component"); binding.Source = propertyItem; binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(this, ComponentXPropertyEditor.ComponentProperty, binding); return(this); }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { var editor = new MemoEdit(); editor.AcceptsReturn = false; editor.ShowBorder = false; editor.IsReadOnly = true; editor.ShowIcon = false; editor.Background = Brushes.Transparent; editor.TextWrapping = TextWrapping.NoWrap; editor.MemoTextWrapping = TextWrapping.WrapWithOverflow; editor.MemoVerticalScrollBarVisibility = ScrollBarVisibility.Auto; editor.Height = 22; editor.PopupWidth = 500; editor.PopupFooterButtons = PopupFooterButtons.Close; var binding = new Binding("Value"); binding.Source = propertyItem; binding.ValidatesOnExceptions = true; binding.ValidatesOnDataErrors = true; binding.Mode = BindingMode.OneWay; BindingOperations.SetBinding(editor, BaseEdit.EditValueProperty, binding); return editor; }
FrameworkElement ITypeEditor.ResolveEditor(PropertyItem propertyItem) { BindingOperations.SetBinding(this, SettingsProperty, new Binding("Value") { Source = propertyItem, ValidatesOnExceptions = true, ValidatesOnDataErrors = true, Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay, }); return this; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { return new TextBlock(); }
private PropertyItem CreatePropertyItem( PropertyDescriptor property, PropertyDefinition propertyDef ) { DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition( property, SelectedObject, this.PropertyContainer.IsCategorized ); definition.InitProperties(); this.InitializeDescriptorDefinition( definition, propertyDef ); PropertyItem propertyItem = new PropertyItem( definition ); Debug.Assert( SelectedObject != null ); propertyItem.Instance = SelectedObject; propertyItem.CategoryOrder = this.GetCategoryOrder( definition.CategoryValue ); return propertyItem; }
protected virtual void OnSelectedPropertyChanged( PropertyItem oldValue, PropertyItem newValue ) { if( oldValue != null ) oldValue.IsSelected = false; //if (newValue != null) // newValue.IsSelected = true; RaiseEvent( new RoutedEventArgs( PropertyGrid.SelectedPropertyItemChangedEvent, newValue ) ); }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { var layerColor = (System.Drawing.Color)propertyItem.Value; ChangeButtonColor(layerColor); button.Click += delegate { var colorDialog = new ColorDialog(); colorDialog.ShowDialog(); layerColor = colorDialog.Color; ChangeButtonColor(layerColor); propertyItem.Value = layerColor; }; return button; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { var isSelected = propertyItem.Value; var comboBox = new ComboBox(); var cbOn = new ComboBoxItem { Content = "Включен", IsSelected = (bool)isSelected }; comboBox.Items.Add(cbOn); var cbOff = new ComboBoxItem { Content = "Выключен", IsSelected = !(bool)isSelected }; comboBox.Items.Add(cbOff); comboBox.SelectionChanged += (sender, args) => propertyItem.Value = cbOn.IsSelected; return comboBox; }
private PropertyItem CreatePropertyItem( PropertyDescriptor property ) { DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition( property, SelectedObject ); definition.InitProperties(); PropertyItem propertyItem = new PropertyItem( definition ); Debug.Assert( SelectedObject != null ); propertyItem.Instance = SelectedObject; return propertyItem; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { DataContext = propertyItem; return this; }
public FrameworkElement ResolveEditor(PropertyItem propertyItem) { var editor = new IntegerUpDown(); editor.TextAlignment = System.Windows.TextAlignment.Left; var attr = propertyItem.PropertyDescriptor.Attributes.OfType<RangeAttribute>().FirstOrDefault(); editor.Value = (int)propertyItem.Value; editor.Minimum = (int)attr.Minimum; editor.Maximum = (int)attr.Maximum; return editor; }