Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Style not honoring value set by StaticResource in Resources?

$
0
0

Hello Everyone,

I have set certain values to a property (IconWidth) in the Resources of a content view. This property is being used in a Style also contained in the same place.
However, when this is used in the style, the Image view seems to ignore this.
For example -
This doesn't work

    <OnPlatform x:TypeArguments="x:Int32" Android="32" iOS="32" Default="32" x:Key="IconWidthVertical"/>

    <Style TargetType="Image" x:Key="statusIconStyles">
    <Setter Property="WidthRequest" Value="{StaticResource Key=IconWidthVertical}" />
    <Setter Property="Aspect" Value="AspectFit"/>
    </Style>

However, this does -

    <Style TargetType="Image" x:Key="statusIconStyles">
        <Setter Property="WidthRequest" Value="32" />
        <Setter Property="Aspect" Value="AspectFit"/>
    </Style>

What am I doing wrong here? Why dosen't the StaticResource binding work?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>