hi there,
I also get the same error.. I also get a related error when you do the next tutorial regarding the Control Templates and applying custome Visual States.
Within the
PHP Code:
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonButtonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Pressed" >
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetName="MainBorder" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="Red" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel>
<Image Source="Images\wrox.png" Width="200" Height="300" />
<TextBlock TextAlignment="Center" />
</StackPanel>
</Border>
</Grid>
</ControlTemplate>
when you add a button and use this template there is an exception thrown when you click the button
+ _exception {"Cannot resolve TargetName MainBorder."} System.Exception {System.InvalidOperationException}
If anyone else knows how / why this is occurring it would be great to know so I can continue with the exercises. Also maybe needed for future revisions of the book..
to the OP I am also asking via stack overflow so if I get an answer I'll post a link here, could you do the same as well if you figure it out?
Thanks