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

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