ivp
ivp

Reputation: 35

How to create auto-bindings from property attributes?

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:

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

Answers (0)

Related Questions