Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning Windows Phone 7 Application Development: Building Windows Phone Applications Using S
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
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
  #2 (permalink)  
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.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 05: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



All times are GMT -4. The time now is 11:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.