public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource) { if (propertyValue == null) return; if (propertyValue.ParentProperty.IsReadOnly) return; OpenFileDialog ofd = new OpenFileDialog { Filter = "Image Files (*.jpg, *.png, *.bmp)|*.jpg;*.png;*.bmp", Multiselect = false }; if (ofd.ShowDialog() == true) { propertyValue.StringValue = ofd.FileName; } }
public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource) { if (propertyValue == null) return; if (propertyValue.ParentProperty.IsReadOnly) return; var ofd = new OpenFileDialog(); ofd.Multiselect = false; var property = propertyValue.ParentProperty; if (property != null) { var optionsAttribute = (OpenFileDialogOptionsAttribute)property.Attributes[typeof(OpenFileDialogOptionsAttribute)]; if (optionsAttribute != null) optionsAttribute.ConfigureDialog(ofd); } if (ofd.ShowDialog() == true) propertyValue.StringValue = ofd.FileName; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyItem"/> class. /// </summary> /// <param name="parentValue">The parent value.</param> protected PropertyItem(PropertyItemValue parentValue) { _parentValue = parentValue; }
public PropertyItemMock(PropertyItemValue value) : base(value) { }
public void ShouldReturnParentValue() { PropertyItemValue value = new PropertyItemValue(new PropertyItemMock()); PropertyItem property = new PropertyItemMock(value); Assert.AreEqual(value, property.ParentValue); }