Question

I have Visuals state for List Item Border like the below:

<VisualStateGroup x:Name="CommonStates">
    <VisualState x:Name="Normal"/>
        <VisualState x:Name="MouseOver">
            <Storyboard>
                <ObjectAnimationUsingKeyFrames
                    Storyboard.TargetName="ListItemBorder"
                    Storyboard.TargetProperty="Background">

                    // how to pass the value to here. 
                    <DiscreteObjectKeyFrame KeyTime="0" Value="#c9vbf2"/>

                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
    <VisualState x:Name="Disabled"/>
</VisualStateGroup>

How can i change the value c9vbf2. I have the value in my AppResources.

I am working on WP8

Was it helpful?

Solution

You can refer to your AppResource like that:

<VisualStateGroup x:Name="CommonStates">
  <VisualState x:Name="Normal"/>
    <VisualState x:Name="MouseOver">
      <Storyboard>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ListItemBorder" Storyboard.TargetProperty="Background">
          <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource YourCustomBrush}" />
        </ObjectAnimationUsingKeyFrames>
      </Storyboard>
    </VisualState>
  <VisualState x:Name="Disabled"/>
</VisualStateGroup>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top