我使用了TOOLKIT ListPicker。但是这些项目并未以全屏模式显示。它是一个单击ListPicker的空白页面,但项目呈现透明,甚至可以选择。它似乎空白页面,但项目在那里。ListPicker项目未以FullScreen模式显示
<phone:PhoneApplicationPage
x:Class="Sunder_Gutka.SettingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Name="PickerItemTemplate">
<TextBlock Text="{Binding BackGroundColorArray}" />
</DataTemplate>
<DataTemplate x:Name="PickerFullModeItemTemplate" >
<TextBlock Name="BackgroundColor"
Text="{Binding BackGroundColorArray}"
/>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<toolkit:ListPicker x:Name="BackgroundColor" FullModeHeader="Select Background Color:" Header="Background Color:" BorderThickness="0" FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" ItemTemplate="{StaticResource PickerItemTemplate}" Background="#FF09043C" SelectionChanged="BackgroundColor_SelectionChanged" >
</toolkit:ListPicker>
</Grid>
</Grid>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace Sunder_Gutka
{
public partial class SettingPage : PhoneApplicationPage
{
String[] BackGroundColorArray = { "Black", "Light Grey", "White[Default]", "Blue", "Green", "Saffron", "Yellow", "Magenta", "Dark Grey", "Red" }; //To be used in LISTPICKER
public SettingPage()
{
InitializeComponent();
this.BackgroundColor.ItemsSource = BackGroundColorArray; //Item Source of listpicker
}
string SelectedBackgroundColor;
private void BackgroundColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectedBackgroundColor = BackgroundColor.SelectedItem.ToString();
}
}
它显然会工作。但我全屏显示UGLY列表。我试图去设计它。同样的线在我的另一个项目中工作正常。这里可能是什么问题? – 2014-09-04 11:54:43
明显是什么意思?你问简单的问题,这是一个答案。现在你正在增加你的查询。询问问题时请具体。你可以绑定列表或集合到绑定,所以在这里它不起作用。尝试使用列表或观察集合,然后它会完美地工作。如果我的答案对您有帮助,请为其他人标记为未来参考答案。 – 2014-09-04 11:59:30
我告诉你的是,我得到页面上的列表,我通过调试进行了检查,但没有显示出我在新项目中实现的 – 2014-09-04 12:21:51