Reputation: 1975
I would like to define a double that will always be the left margin value in two difference Thickness values, both of which will be used in multiple places. E.g.:
<x:Double x:Key="BreadcrumbElementLeftMargin">23</x:Double>
<Thickness x:Key="BreadcrumbTextElementMargin">(reference value 23 above),20,0,0</Thickness>
<Thickness x:Key="BreadcrumbImageElementMargin">(reference value 23 above),40,0,0</Thickness>
Is there a way to do that?
Upvotes: 2
Views: 439
Reputation: 50672
No, this is not possible in UWP because in UWP Thickness has no default constructor so the Left, Top, Right and Bottom properties cannot be set individually.
Side note: In WPF this can be done like this:
<x:Double x:Key="BreadcrumbElementLeftMargin">23</x:Double>
<Thickness x:Key="BreadcrumbTextElementMargin"
Bottom="0"
Left="{StaticResource BreadcrumbElementLeftMargin}"
Right="0"
Top="20" />
<Thickness x:Key="BreadcrumbImageElementMargin"
Bottom="0"
Left="{StaticResource BreadcrumbElementLeftMargin}"
Right="0"
Top="40" />
Upvotes: 2