using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace OpenSEMI.ClientBase.Command
{
public class PropertyCommandTrigger : CommandTrigger
{
#region Dependency Properties
#region Property Property
/// Identifies the Property dependency property
public static readonly DependencyProperty PropertyProperty =
DependencyProperty.Register("Property", typeof(DependencyProperty), typeof(PropertyCommandTrigger),
new FrameworkPropertyMetadata(null));
/// description for Property property
public DependencyProperty Property
{
get { return (DependencyProperty)GetValue(PropertyProperty); }
set { SetValue(PropertyProperty, value); }
}
#endregion
#region Value Property
/// Identifies the Value dependency property
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(string), typeof(PropertyCommandTrigger),
new FrameworkPropertyMetadata(null));
/// description for Value property
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
#endregion
#endregion
protected override Freezable CreateInstanceCore()
{
return new PropertyCommandTrigger();
}
#region T Property
/// Identifies the T dependency property
public static readonly DependencyProperty TProperty =
DependencyProperty.Register("T", typeof(object), typeof(PropertyCommandTrigger),
new FrameworkPropertyMetadata(null, OnTChanged));
/// description for T property
public object T
{
get { return (object)GetValue(TProperty); }
set { SetValue(TProperty, value); }
}
///
/// Invoked on T change.
///
/// The object that was changed
/// Dependency property changed event arguments
static void OnTChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
#endregion
protected override void InitializeCore(FrameworkElement source)
{
DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(Property, source.GetType());
descriptor.AddValueChanged(source, (s, e) =>
{
CommandParameter