I have a custom MarkupExtension that simulates binding. It works well in normal assignments but when used in Style Setters, for example:
Kind of guessing, but it's likely because the XAML compiler has special built-in support for the Binding
class, allowing its usage in this scenario (and others). The Binding
class is also a MarkupExtension
, but unfortunately it seals its implementation of ProvideValue()
.
That said, you might just get away with this:
public class MyBinding : Binding
{
private object value;
public object Value
{
get { return this.value; }
set
{
this.value = value;
this.Source = value;
}
}
}
Since ProvideValue
will return the Binding
instance anyway.