Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Windows Phone 7 Application Development: Building Windows Phone Applications Using S
This is the forum to discuss the Wrox book Beginning Windows Phone 7 Application Development: Building Windows Phone Applications Using Silverlight and XNA by Nick Lecrenski, Karli Watson, Robert Fonseca-Ensor; ISBN: 978-0-470-91233-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Windows Phone 7 Application Development: Building Windows Phone Applications Using S section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2012, 03:29 AM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question VisualStates example not working if use Animation objects (step 9)

VisualStates example not working if use Animation objects that start in step 9.

What happens is that the background does not change opacity and the border does not change color. Have tried exactly as from download and slightly changed, always same result.

Any ideas, new to Windows Phone Dev and C#.

This style code works (uses methodology from step 8):
PHP Code:
        <Style x:Key="ImageButtonStyle" TargetType="Button" >
            <
Setter Property="Template">
                <
Setter.Value>
                    <
ControlTemplate TargetType="Button">
                        <
Grid>
                          <
VisualStateManager.VisualStateGroups>
                            <
VisualStateGroup x:Name="CommonButtonStates">
                                <
VisualState x:Name="Normal" />
                                    <
VisualState x:Name="Pressed" >
                                        <
Storyboard>

                                            <!-- 
Working choice to use is w/out animation which is below  -->

                                            
                                            <
ObjectAnimationUsingKeyFrames Duration="0"
                                            
Storyboard.TargetName="MainBorder"                                           
                                            
Storyboard.TargetProperty="BorderBrush" >
                                                <
DiscreteObjectKeyFrame KeyTime="0" Value="Blue" /> 
                                            </
ObjectAnimationUsingKeyFrames>  
                                           
                                            <
ObjectAnimationUsingKeyFrames Duration="0"
                                                 
Storyboard.TargetName="MainImage"
                                                 
Storyboard.TargetProperty="Opacity">
                                                <
DiscreteObjectKeyFrame KeyTime="0" Value=".5" />
                                            </
ObjectAnimationUsingKeyFrames>
                                            
                                            
                                            <!-- 
Other choice to use is Animation which are belowbut did not workshowed on device and emulator but no response to pressing -->
                                            <!--
                                            <
ColorAnimation Storyboard.TargetName="MainBorder" Storyboard.TargetProperty="Border.BorderBrush.SolidColorBrush.Color" From="White" To="Red" Duration="0:0:1" />   
                                            <
DoubleAnimation Storyboard.TargetName="MainImage" Storyboard.TargetProperty="Opacity" To=".5" Duration="0:0:1" /> 
                                            <
DoubleAnimation Storyboard.TargetName="MainText" Storyboard.TargetProperty="Opacity" To=".5" Duration="0:0:1" />
                                            -->
                                        </
Storyboard>
                                        
                                        
                                    </
VisualState>
                                <
VisualState x:Name="Disabled" />
                            </
VisualStateGroup>
                          </
VisualStateManager.VisualStateGroups>

                         <
Border x:Name="MainBorder"
                                 
Width="{TemplateBinding Width}"
                                 
Height="{TemplateBinding Height}"
                                 
BorderBrush="{TemplateBinding BorderBrush}" 
                                 
BorderThickness="{TemplateBinding BorderThickness}">

                                <
StackPanel x:Name="MainPanel" Background="Black"
                                    
Margin="{TemplateBinding Margin}"
                                    
Height="{TemplateBinding Height}" 
                                    
Width"{TemplateBinding Width}">
                                   
                                    
                                    <
Image  x:Name="MainImage"
                                            
Margin="10"
                                            
Height="200"
                                            
Width="300"
                                            
Source="Images/wrox.png" />
                                    <
TextBlock x:Name="MainText" Text="{TemplateBinding Content}" TextAlignment="Center" />
                                </
StackPanel>
                         </
Border>
                        </
Grid>
                    </
ControlTemplate>
                </
Setter.Value>
            </
Setter>
        </
Style

This style code does not (uses methodology from step 9):
PHP Code:
       <Style x:Key="CustomImageButtonStyle" TargetType="Button" >
            <
Setter Property="Template">
                <
Setter.Value>
                    <
ControlTemplate TargetType="Button">
                        <
Grid>
                            <
VisualStateManager.VisualStateGroups>
                                <
VisualStateGroup x:Name="CommonButtonStates">
                                    <
VisualState x:Name="Normal" />
                                    <
VisualState x:Name="Pressed" >
                                        <
Storyboard>

                                            <!-- 
Working choice to use is w/out animation which is below  -->

                                            <!--
                                            <
ObjectAnimationUsingKeyFrames Duration="0"
                                            
Storyboard.TargetName="MainBorder"                                           
                                            
Storyboard.TargetProperty="BorderBrush" >
                                                <
DiscreteObjectKeyFrame KeyTime="0" Value="Blue" /> 
                                            </
ObjectAnimationUsingKeyFrames>  
                                           
                                            <
ObjectAnimationUsingKeyFrames Duration="0"
                                                 
Storyboard.TargetName="MainImage"
                                                 
Storyboard.TargetProperty="Opacity">
                                                <
DiscreteObjectKeyFrame KeyTime="0" Value=".5" />
                                            </
ObjectAnimationUsingKeyFrames>
                                            -->

                                            <!-- 
Other choice to use is Animation which are belowbut did not workshowed on device and emulator but no response to pressing -->

                                            <
ColorAnimation Storyboard.TargetName="MainBorder" Storyboard.TargetProperty="Border.BorderBrush.SolidColorBrush.Color" From="White" To="Red" Duration="0:0:1" />
                                            <
DoubleAnimation Storyboard.TargetName="MainImage" Storyboard.TargetProperty="Opacity" To=".5" Duration="0:0:1" />
                                            <
DoubleAnimation Storyboard.TargetName="MainText" Storyboard.TargetProperty="Opacity" To=".5" Duration="0:0:1" />

                                        </
Storyboard>


                                    </
VisualState>
                                    <
VisualState x:Name="Disabled" />
                                </
VisualStateGroup>
                            </
VisualStateManager.VisualStateGroups>
                            <
Border x:Name="MainBorder"
                                 
Width="{TemplateBinding Width}"
                                 
Height="{TemplateBinding Height}"
                                 
BorderBrush="{TemplateBinding BorderBrush}" 
                                 
BorderThickness="{TemplateBinding BorderThickness}">
                                <
StackPanel x:Name="MainPanel" Background="Black">
                                    <
Image  x:Name="MainImage" Source="Images/wrox.png" Width="300" Height="200" />
                                    <
TextBlock x:Name="MainText" Text="{TemplateBinding Content}" TextAlignment="Center" />
                                </
StackPanel>
                            </
Border>
                        </
Grid>
                    </
ControlTemplate>
                </
Setter.Value>
            </
Setter>
        </
Style
 
Old July 18th, 2012, 03:09 PM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Is it possible my graphics unit does not have full support so I get this error?

Is it possible my graphics unit does not have full support so I get this error?

I do get a warning when I load the emulator about lacking full support.

However, I get the same error when I test on a phone that does have support.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Line object from two point objects and using objects as variables skf001 BOOK: Ivor Horton's Beginning Java, Java 7 Edition 4 May 15th, 2012 07:56 PM
XamlParseException in VisualStates example neville BOOK: Beginning Windows Phone 7 Application Development: Building Windows Phone Applications Using S 3 March 23rd, 2012 11:52 AM
Is there a step-by-step manual for exercises? sendalot BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 2 January 16th, 2012 06:23 PM
How detailed are the step-by-step littleccguy BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 May 18th, 2006 03:45 PM
We Based Database Step By step desireemm SQL Language 1 October 15th, 2005 08:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.