WPF Extension
A library help to WPF Programming
Install-Package Evan.Wpf
Methods | Need Property |
---|---|
Register() | YES |
Register<T>() | NO |
RegisterReadOnly() | YES |
RegisterReadOnly<T>() | NO |
RegisterAttached() | YES |
RegisterAttached<T>() | NO |
RegisterAttachedReadOnly() | YES |
RegisterAttachedReadOnly<T>() | NO |
Using namespace
using Evan.Wpf;
Basic Register
// Basic Register Dependency Property
public static DependencyProperty TextProperty =
DependencyHelper.Register();
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
Basic Register - Exception Sample
// Throw DependencyHelperException
public static DependencyProperty TextProperty =
DependencyHelper.Register();
public string Title
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
Register only
// Register Only Dependency Property
public static DependencyProperty TextProperty =
DependencyHelper.Register<string>();
// It is not necessary string property.
Add Value Changed from DependencyPropertyDescriptor
// Add Event
<DependencyProperty>.AddValueChanged(<Parent(DependencyObject)>, <EventHandler>);
// Remove Event
<DependencyProperty>.RemoveValueChanged(<Parent(DependencyObject)>, <EventHandler>);