Esempio n. 1
0
        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;
        }
Esempio n. 3
0
 /// <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;
 }
Esempio n. 4
0
 public PropertyItemMock(PropertyItemValue value)
     : base(value)
 {
 }
Esempio n. 5
0
        public void ShouldReturnParentValue()
        {
            PropertyItemValue value = new PropertyItemValue(new PropertyItemMock());
              PropertyItem property = new PropertyItemMock(value);

              Assert.AreEqual(value, property.ParentValue);
        }