Hi,
I'm a newbie to using a VSM but expected the code below to light up the border when the mouse was over the control. However, it does nothing. Would any kind soul be able to nudge me in the right direction, please?
<UserControl x:Class="VisualStateTest.CListSearchTextBox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"><Grid x:Name="RootElement"><VisualStateManager.VisualStateGroups><VisualStateGroup x:Name="CommonStates"><VisualStateGroup.Transitions><VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver" /><VisualTransition From="Normal" GeneratedDuration="00:00:00.3000000" To="MouseOver" /><VisualTransition From="MouseOver" GeneratedDuration="00:00:00.5000000" To="Normal" /></VisualStateGroup.Transitions><VisualState x:Name="Normal" /><VisualState x:Name="MouseOver"><Storyboard><DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)"><SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5" /></DoubleAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup></VisualStateManager.VisualStateGroups><Border x:Name="HoverBorder" IsHitTestVisible="False" Opacity="0" BorderThickness="2" BorderBrush="Red" CornerRadius="2,2,2,2" /></Grid></UserControl>
You have to put it on something so here's my Main.xml
<Window x:Class="VisualStateTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:VisualStateTest" Title="MainWindow" Height="350" Width="525"><Grid><local:CListSearchTextBox Width="200" Height="30" Background="AliceBlue"></local:CListSearchTextBox></Grid></Window>
Many thanks,
Adam.