How to change background color of Windows Phone Listpicker in FullScreen Mode


SUBMITTED BY: Guest

DATE: Nov. 16, 2013, 3:27 a.m.

FORMAT: Text only

SIZE: 7.7 kB

HITS: 977

  1. How to change background color of Windows Phone Listpicker in FullScreen Mode
  2. <Style TargetType="toolkit:ListPicker" x:Key="ListPickerStyle1">
  3. <!--<Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>-->
  4. <!--<Setter Property="Background" Value="YellowGreen"/>-->
  5. <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
  6. <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
  7. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  8. <Setter Property="Margin" Value="{StaticResource PhoneTouchTargetOverhang}"/>
  9. <Setter Property="Template">
  10. <Setter.Value>
  11. <ControlTemplate TargetType="toolkit:ListPicker">
  12. <StackPanel>
  13. <VisualStateManager.VisualStateGroups>
  14. <VisualStateGroup x:Name="PickerStates">
  15. <VisualState x:Name="Normal"/>
  16. <VisualState x:Name="Expanded">
  17. <Storyboard>
  18. <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="Background" Duration="0"> <DiscreteObjectKeyFrame Value="{StaticResource PhoneTextBoxEditBackgroundColor}" KeyTime="0"/> </ObjectAnimationUsingKeyFrames>-->
  19. <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush" Duration="0">
  20. <DiscreteObjectKeyFrame Value="Yellow" KeyTime="0"/>
  21. </ObjectAnimationUsingKeyFrames>
  22. <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderThickness" Duration="0">
  23. <DiscreteObjectKeyFrame Value="200" KeyTime="0"/>
  24. </ObjectAnimationUsingKeyFrames>
  25. </Storyboard>
  26. </VisualState>
  27. </VisualStateGroup>
  28. </VisualStateManager.VisualStateGroups>
  29. <ContentControl Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}"
  30. Foreground="{StaticResource PhoneSubtleBrush}" FontSize="{StaticResource PhoneFontSizeNormal}"
  31. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0 0 0 8"/>
  32. <Grid>
  33. <!--<Border x:Name="Border" Background="Yellow" BorderBrush="{TemplateBinding Background}" BorderThickness="2">-->
  34. <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Background}" BorderThickness="2">
  35. <Canvas x:Name="ItemsPresenterHost" MinHeight="46">
  36. <ItemsPresenter x:Name="ItemsPresenter">
  37. <ItemsPresenter.RenderTransform>
  38. <TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
  39. </ItemsPresenter.RenderTransform>
  40. </ItemsPresenter>
  41. </Canvas>
  42. </Border>
  43. <Popup x:Name="FullModePopup">
  44. <!--<Border Background="{StaticResource PhoneChromeBrush}">-->
  45. <Border Background="Yellow" BorderThickness="200">
  46. <!-- Popup.Child should always be a Border -->
  47. <Grid Background="Yellow">
  48. <Grid.RowDefinitions>
  49. <RowDefinition Height="Auto"/>
  50. <RowDefinition/>
  51. </Grid.RowDefinitions>
  52. <ContentControl Grid.Row="0" Content="{TemplateBinding FullModeHeader}" Background="Yellow"
  53. Foreground="{StaticResource PhoneForegroundBrush}"
  54. FontFamily="{StaticResource PhoneFontFamilySemiBold}" FontSize="{StaticResource PhoneFontSizeMedium}"
  55. HorizontalAlignment="Left" Margin="24 12 0 0"/>
  56. <ListBox x:Name="FullModeSelector" Grid.Row="1" ItemTemplate="{TemplateBinding ActualFullModeItemTemplate}"
  57. FontSize="{TemplateBinding FontSize}" Margin="{StaticResource PhoneMargin}" Background="Yellow">
  58. <ListBox.ItemsPanel>
  59. <ItemsPanelTemplate>
  60. <StackPanel Background="Yellow"/>
  61. <!-- Ensures all containers will be available during the Loaded event -->
  62. </ItemsPanelTemplate>
  63. </ListBox.ItemsPanel>
  64. </ListBox>
  65. </Grid>
  66. </Border>
  67. </Popup>
  68. </Grid>
  69. </StackPanel>
  70. </ControlTemplate>
  71. </Setter.Value>
  72. </Setter>
  73. </Style>
  74. using System.Collections;
  75. using System.Windows;
  76. using System.Windows.Controls;
  77. namespace Microsoft.Phone.Controls
  78. {
  79. public interface IListPickerPage
  80. {
  81. string HeaderText { get; set; }
  82. IList Items { get; }
  83. SelectionMode SelectionMode { get; set; }
  84. object SelectedItem { get; set; }
  85. IList SelectedItems { get; }
  86. DataTemplate FullModeItemTemplate { get; set; }
  87. bool IsOpen { get; set; }
  88. }
  89. }
  90. <toolkit:ListPicker x:Name="lpStr"
  91. Grid.RowSpan="2"
  92. Width="1"
  93. Height="1"
  94. CacheMode="BitmapCache"
  95. ExpansionMode="FullScreenOnly"
  96. Foreground="Black"
  97. FullModeItemTemplate="{StaticResource ListPickerStringLargeTemplate}"
  98. IsHitTestVisible="False"
  99. Opacity="0"
  100. PickerPageUri="/Views/Globals/ToolkitPages/MyListPickerPage.xaml" />
  101. </Grid>

comments powered by Disqus