using System; using System.Windows; namespace OpenSEMI.ClientBase.Command { public class PropertyCommandParameter : CommandParameter { public DependencyProperty Property { get; private set; } public TValue Value { get; private set; } public PropertyCommandParameter(TCustomParameter customParameter, DependencyProperty property, TValue value) : base(customParameter) { Property = property; Value = value; } public new static PropertyCommandParameter Cast(object parameter) { PropertyCommandParameter propertyCommandParameter = parameter as PropertyCommandParameter; if (propertyCommandParameter == null) { throw new InvalidCastException($"Failed to case {parameter.GetType()} to {typeof(PropertyCommandParameter)}"); } return new PropertyCommandParameter((TCustomParameter)propertyCommandParameter.CustomParameter, propertyCommandParameter.Property, (TValue)propertyCommandParameter.Value); } } }