public override void ShowDialog(PropertyValue propertyValue, Windows.IInputElement commandSource) { ModelPropertyEntryToOwnerActivityConverter propertyEntryConverter = new ModelPropertyEntryToOwnerActivityConverter(); ModelItem parentModelItem = (ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null); EditingContext context = ((IModelTreeItem)parentModelItem).ModelTreeManager.Context; ModelItemDictionary inputData = parentModelItem.Properties[propertyValue.ParentProperty.PropertyName].Dictionary; DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions(); options.Title = propertyValue.ParentProperty.DisplayName; DynamicArgumentDialog.ShowDialog(parentModelItem, inputData, context, parentModelItem.View, options); }
/// <summary> /// Creates a PropertyValueExceptionEventArgs /// </summary> /// <param name="message">A message indicating what failed</param> /// <param name="value">The PropertyValue in which the exception is occuring</param> /// <param name="source">The source that generated this exception (get or set)</param> /// <param name="exception">The inner excpetion</param> /// <exception cref="ArgumentNullException">When message is null</exception> /// <exception cref="ArgumentNullException">When value is null</exception> /// <exception cref="ArgumentNullException">When exception is null</exception> public PropertyValueExceptionEventArgs(string message, PropertyValue value, PropertyValueExceptionSource source, Exception exception) { if (message == null) throw FxTrace.Exception.ArgumentNull("message"); if (value == null) throw FxTrace.Exception.ArgumentNull("value"); if (!EnumValidator.IsValid(source)) throw FxTrace.Exception.AsError(new ArgumentOutOfRangeException("source")); if (exception == null) throw FxTrace.Exception.ArgumentNull("exception"); _message = message; _value = value; _source = source; _exception = exception; }
// <summary> // Removes the specified PropertyValue from the collection. // </summary> // <param name="property">Property to remove</param> // <returns>True, if the PropertyValue was found and removed, false // otherwise.</returns> public override bool Remove(PropertyValue propertyValue) { if (propertyValue == null) { throw FxTrace.Exception.ArgumentNull("property"); } if (_values == null) { return false; } for (int i = 0; i < _values.Count; i++) { if (_values[i].PropertyValue == propertyValue) { this.RemoveAt(i); return true; } } // Call to RemoveAt() already fires the right CollectionChanged events return false; }
/// <summary> /// Creates a PropertyEntry that acts as a sub-property of the specified PropertyValue. /// For host infrastructure derived classes. /// </summary> /// <param name="parentValue">The parent PropertyValue. /// Root properties do not have a parent PropertyValue.</param> protected PropertyEntry(PropertyValue parentValue) { _parentValue = parentValue; }
// <summary> // Looks for the x:Name or Name property of the given PropertyValue and returns it if found. // Note: this method is expensive because it evaluates all the sub-properties of the given // PropertyValue. // </summary> // <param name="propertyValue">PropertyValue instance to look at</param> // <returns>Name if the PropertyValue defines one, null otherwise</returns> public static string GetPropertyName(PropertyValue propertyValue) { if (propertyValue == null) { return null; } if (propertyValue.HasSubProperties) { PropertyEntry nameProperty = propertyValue.SubProperties["Name"]; if (nameProperty != null) { return nameProperty.PropertyValue.StringValue; } } return null; }
protected ModelPropertyEntryBase(PropertyValue parentValue) : base(parentValue) { UpdateDepth(); }