Xamarin - is there any way that Visual State Manager definitons can be put into a ResourceDictionary

Viewed 220

Xamarin 3.0 Is there any way that Visual State Manager (VSM) definitons can be put into a single Resource Dictionary. If this is possible please could you provide an example. Thank you in anticipation.

1 Answers

XAML Example of a Normal/Disable state applied to an Entry:

<ResourceDictionary>
  <Style TargetType="Entry" ApplyToDerivedTypes="True">
    <Setter Property="VisualStateManager.VisualStateGroups">
      <VisualStateGroupList x:Name="CommonStates">
        <VisualStateGroup>
          <VisualState x:Name="Normal">
            <VisualState.Setters>
              <Setter Property="BackgroundColor" Value="Green" />
            </VisualState.Setters>
          </VisualState>
          <VisualState x:Name="Disable">
            <VisualState.Setters>
              <Setter Property="BackgroundColor" Value="Gray"/>
            </VisualState.Setters>
          </VisualState>
        </VisualStateGroup>
      </VisualStateGroupList>
    </Setter>
  </Style>
</ResourceDictionary>
Related