I’m trying to bind to a Readonly property with OneWayToSource as mode, but it seems this cannot be done in XAML:
<controls:FlagThingy IsModified='{Binding FlagIsModified, ElementName=container, Mode=OneWayToSource}' />
I get:
The property ‘FlagThingy.IsModified’ cannot be set because it does not have an accessible set accessor.
IsModified is a readonly DependencyProperty on FlagThingy. I want to bind that value to the FlagIsModified property on the container.
To be clear:
FlagThingy.IsModified --> container.FlagIsModified ------ READONLY ----- ----- READWRITE --------
Is this possible using just XAML?
Update: Well, I fixed this case by setting the binding on the container and not on the FlagThingy. But I’d still like to know if this is possible.
Some research results for OneWayToSource…
Option # 1.
Option # 2
Option # 3 (True read-only dependency property)
System.ArgumentException: ‘IsModified’ property cannot be data-bound.
Reflector gives the answer: