在我的WP7应用程序中,我的ListPicker有这个XAML:
<toolkit:ListPicker HorizontalAlignment="Left" ExpansionMode="FullScreenOnly" Height="70" x:Name="ddLinks" VerticalAlignment="Top" Width="419" FullModeHeader="Category" SelectionChanged="ddLinks_SelectionChanged">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding linkCatName}" Name="lblLinkCat" />
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding linkCatName}" Name="lblLinkCat" FontSize="48" />
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>下面是下面的C#代码:
while (condition)
{
// code to set value of the vars
this.ddLinks.Items.Add(new LinkCats(linkCatName, linkCatAnchor, linksInCat));
}和几个对象:
public class LinkCats
{
public string linkCatName { get; set; }
public string linkCatAnchor { get; set; }
public List<Links> linksInCat { get; set; }
public LinkCats() { }
public LinkCats(string pLinkCatName, string pLinkCatAnchor, List<Links> pLinksInCat)
{
this.linkCatName = pLinkCatName;
this.linkCatAnchor = pLinkCatAnchor;
this.linksInCat = pLinksInCat;
}
}
public class Links
{
public string linkName { get; set; }
public string linkPath { get; set; }
public Links() { }
public Links(string pName, string pLink)
{
this.linkName = pName;
this.linkPath = pLink;
}
}页加载完成后,它将在控件中和调试时显示作为选定项添加的第一个项。但如果我单击ListPicker,什么也不会发生。我不能从其他选项中选择。
发布于 2012-04-28 23:07:43
我想我知道问题出在哪里,但我不确定,所以你必须先测试它。ListPickers ItemTemplate只是一个单独的TextBlock,我认为它应该放在Stackpanel中。
看看下面的链接。
Working With The WP7 ListPicker
发布于 2014-02-05 14:51:17
我想我知道问题出在哪里,但我不确定,所以你必须先测试它。ListPickers ItemTemplate只是一个单独的TextBlock,我认为它应该放在Stackpanel中。
看看下面的链接。
使用WP7 ListPicker
https://stackoverflow.com/questions/10363656
复制相似问题