Reputation: 35
I have some data structure looking like:
public class MockObject
{
[ReadOnlyMember("BooleanProperty")]
public string StringProperty { get; set; }
public bool BooleanProperty { get; set; }
}
And a custom control which I can bind like this:
<uitest:SandboxControl Text="{Binding StringProperty}" IsReadOnly="{Binding BooleanProperty}"></uitest:SandboxControl>
I am looking for proper way to reach next behaviour:
<uitest:SandboxControl BindTo="{Binding StringProperty}"></uitest:SandboxControl>
x:DataType
declared at my root markupStringProperty
PropertyInfo
and extract value from ReadOnlyMemberAttribute ("BooleanProperty")
BindTo
property and creates bindingsText="{Binding StringProperty}" IsReadOnly="{Binding BooleanProperty}"
If this approach is impossible, is there any way to get access to x:DataType
value from CustomControl
code? At least it opens some possibilities to create some kind of control director that will operate with text/readonly values manually.
PS: this is simplified task, because I have a bunch of attributes I have to deal with.
Any help appreciated.
Upvotes: 0
Views: 19