Skip to content

Instantly share code, notes, and snippets.

@rkusa
Created October 8, 2010 21:02
Show Gist options
  • Save rkusa/617543 to your computer and use it in GitHub Desktop.
Save rkusa/617543 to your computer and use it in GitHub Desktop.
<Style TargetType="controls:PickerBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:PickerBox">
<StackPanel>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ButtonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.1"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PopupToggle" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneRadioCheckBoxPressedBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PopupToggle" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneRadioCheckBoxPressedBorderBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBlock Text="{TemplateBinding Label}" Style="{StaticResource PhoneTextSubtleStyle}" />
<ListBoxItem Content="{TemplateBinding SelectedItem}"
ContentTemplate="{TemplateBinding ItemTemplate}"
x:Name="PopupToggle" Margin="20,0" controls:TiltEffect.IsTiltEnabled="True"
BorderThickness="2" BorderBrush="{StaticResource PhoneRadioCheckBoxBrush}"
Background="{StaticResource PhoneRadioCheckBoxBrush}" Foreground="{TemplateBinding Foreground}"/>
<Popup x:Name="PickerPopup" IsOpen="False" Width="480" Height="800">
<Border Background="{StaticResource PhoneChromeBrush}" Width="480" Height="800" Padding="0,32,0,0">
<StackPanel>
<TextBlock x:Name="PickerListHeader" Text="{TemplateBinding Header}" Style="{StaticResource PhoneTextBlockBase}" FontSize="24" Margin="25,20,0,20"/>
<ListBox x:Name="PickerListBox" Height="696" controls:TiltEffect.IsTiltEnabled="True" ItemContainerStyle="{StaticResource PickerBoxItemStyle}" ItemTemplate="{TemplateBinding ItemTemplate}" />
</StackPanel>
</Border>
</Popup>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment