using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;
namespace ModernWpfPlayground.PropertyPresenter2
{
///
///
/// Interaction logic for PropertyPresenter.xaml
///
[ContentProperty(nameof(Value))]
public sealed partial class PropertyPresenter2
{
///
/// Button alignment property.
///
public static readonly DependencyProperty ButtonAlignmentProperty = DependencyProperty.Register(nameof(ButtonAlignment), typeof(Dock), typeof(PropertyPresenter2), new PropertyMetadata(Dock.Right));
///
/// Content of the command property.
///
public static readonly DependencyProperty CommandContentProperty = DependencyProperty.Register(nameof(CommandContent), typeof(object), typeof(PropertyPresenter2), new PropertyMetadata("..."));
///
/// Command Parameter property
///
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register(nameof(CommandParameter), typeof(object), typeof(PropertyPresenter2), new PropertyMetadata(default(object)));
///
/// Command property
///
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(PropertyPresenter2), new PropertyMetadata(default(ICommand)));
///
/// is checked property.
///
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(nameof(IsChecked), typeof(bool?), typeof(PropertyPresenter2), new FrameworkPropertyMetadata(default(bool?), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
///
/// Is readonly property
///
public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register(nameof(IsReadOnly), typeof(bool), typeof(PropertyPresenter2), new PropertyMetadata(default(bool)));
///
/// Label property
///
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(nameof(Label), typeof(string), typeof(PropertyPresenter2), new PropertyMetadata(default(string)));
///
/// label width property.
///
public static readonly DependencyProperty LabelWidthProperty = DependencyProperty.Register(nameof(LabelWidth), typeof(double), typeof(PropertyPresenter2), new PropertyMetadata(150.0));
///
/// Symbol Property
///
public static readonly DependencyProperty SymbolProperty = DependencyProperty.Register(nameof(Symbol), typeof(object), typeof(PropertyPresenter2), new PropertyMetadata(default(object)));
///
/// Value Property
///
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(object), typeof(PropertyPresenter2), new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
///
/// Watermark Property
///
public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register(nameof(Watermark), typeof(string), typeof(PropertyPresenter2), new FrameworkPropertyMetadata(default(string)));
///
public PropertyPresenter2()
{
InitializeComponent();
}
///
/// Button alignment.
///
public Dock ButtonAlignment
{
get => (Dock)GetValue(ButtonAlignmentProperty);
set => SetValue(ButtonAlignmentProperty, value);
}
///
/// Command.
///
public ICommand Command
{
get => (ICommand)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
///
/// Command content.
///
public object CommandContent
{
get => GetValue(CommandContentProperty);
set => SetValue(CommandContentProperty, value);
}
///
/// Command parameter.
///
public object CommandParameter
{
get => GetValue(CommandParameterProperty);
set => SetValue(CommandParameterProperty, value);
}
///
/// IsChecked.
///
public bool? IsChecked
{
get => (bool?)GetValue(IsCheckedProperty);
set => SetValue(IsCheckedProperty, value);
}
///
/// IsReadOnly
///
public bool IsReadOnly
{
get => (bool)GetValue(IsReadOnlyProperty);
set => SetValue(IsReadOnlyProperty, value);
}
///
/// Label.
///
public string Label
{
get => (string)GetValue(LabelProperty);
set => SetValue(LabelProperty, value);
}
///
/// Label width.
///
public double LabelWidth
{
get => (double)GetValue(LabelWidthProperty);
set => SetValue(LabelWidthProperty, value);
}
///
/// Symbol.
///
public object Symbol
{
get => GetValue(SymbolProperty);
set => SetValue(SymbolProperty, value);
}
///
/// Value.
///
public object Value
{
get => GetValue(ValueProperty);
set => SetValue(ValueProperty, value);
}
///
/// Watermark.
///
public string Watermark
{
get => (string)GetValue(WatermarkProperty);
set => SetValue(WatermarkProperty, value);
}
///
public override string ToString() => Value != null ? base.ToString() + " " + Value : base.ToString();
}
}