Is there any simple way to get a value of attached property in UWP?
For instance I have a TextBlock
defined in XAML:
<TextBlock
x:Name="TextBlock"
AutomationProperties.AutomationId="MyTextBlockId"
Grid.Row="1"
Text="My Text Block" />
If I want to get a value of property Text
from string property name, I can use reflection:
TextBlock.GetType().GetProperty("Text").GetValue(TextBlock);
What about attached properties? How can I access attached properties Grid.Row
or AutomationProperties.AutomationId
based on their string "names"?
Of course I can do following:
AutomationProperties.GetAutomationId(TextBlock);
Grid.GetRow(TextBlock);
but I would like to use something like:
TextBlock.GetProperty("AutomationProperties.GetAutomationId");
TextBlock.GetProperty("Grid.Row");
UPDATE
DependencyPropertyDescriptor
is not available in UWP.
Here seems to be the same question, however, it is not possible to use it in UWP.
Getting the attached property "Canvas.Left"