Visual State problems
-
Saturday, August 18, 2012 11:54 PM
Hi, Im trying to manage snapped, filled and portrait states. I have a simple grid with a textbox in the middle row. I want the text to down size when a snapped state is active but its not happening, the text is remaining the same size.
Here is my grid xaml for mainPage
<Grid Margin="10,10,10,10" VerticalAlignment="Center" HorizontalAlignment="Center"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="*" /> <RowDefinition /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto" /> </Grid.ColumnDefinitions> <TextBox x:Name="TitleText" Text="State test" Width="auto" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="48" Grid.Row="1" Foreground="White" IsReadOnly="True" Background="{x:Null}" BorderBrush="{x:Null}"/> <VisualStateManager.VisualStateGroups> <!-- Visual states reflect the application's view state --> <VisualStateGroup x:Name="ApplicationViewStates"> <VisualState x:Name="FullScreenLandscape"/> <VisualState x:Name="Filled"/> <VisualState x:Name="FullScreenPortrait"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TitleText" Storyboard.TargetProperty="Style"> <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HeaderTextStyle}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Snapped"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TitleText" Storyboard.TargetProperty="Style"> <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Grid>Here is my snappedPageHeaderTextStyle<Style x:Key="SnappedPageHeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource PageSubheaderTextStyle}"> <Setter Property="Margin" Value="0,0,10,10"/> <Setter Property="FontSize" Value="10"/> </Style>I presumed when a snapped state is active my fontsize should reduce to 10px
Regards
- Moved by Jeff SandersMicrosoft Employee, Moderator Tuesday, August 21, 2012 2:19 PM xaml (From:UI Design for Metro style apps)
All Replies
-
Thursday, August 23, 2012 4:14 PMModeratorI keep getting XAML parse issues when running this code - can you just send me an app which displays this problem? MSMALL at Microsoft.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


