Reputation: 127
I want to use StaticResource
and benefits from auto complete of VS 2017 by using some syntax like this if it is exist:
<x:Double x:Key="NormalSpacing">
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>
<OnPlatform x:TypeArguments="x:Double" iOS="7" Android="3" />
</OnIdiom.Phone>
<OnIdiom.Tablet>
<OnPlatform x:TypeArguments="x:Double" iOS="15" Android="10" />
</OnIdiom.Tablet>
</OnIdiom>
</x:Double>
shortly I want to give the key to the main tag which contain OnIdiom
and OnPlatform
tags.
Upvotes: 2
Views: 659
Reputation: 2995
Use a style for auto complete with the compact OnIdiom
and OnPlatform
syntax:
<Style x:Key="stackLayoutStyle" TargetType="StackLayout">
<Setter Property="Spacing"
Value="{OnIdiom
Phone = {OnPlatform iOS=7, Android=3 },
Tablet = {OnPlatform iOS=15, Android=10 }}" >
</Setter>
</Style>
...
<StackLayout Style="{StaticResource stackLayoutStyle}">
...
</StackLayout>
Upvotes: 2