0

私の 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 をクリックしても何も起こりません。他のオプションから選択することはできません。

4

2 に答える 2

0

何が問題なのかはわかっていると思いますが、よくわからないので、最初にテストする必要があります。ListPickers ItemTemplate は単一の TextBlock にすぎず、Stackpanel 内に配置する必要があると思います。

以下のリンクをご覧ください。

WP7 ListPicker の操作

于 2014-02-05T06:51:17.340 に答える
0

何が問題なのかはわかっていると思いますが、よくわからないので、最初にテストする必要があります。ListPickers ItemTemplateは 1 つのみで、 の中TextBlockに入れる必要があると思いますStackpanel

以下のリンクをご覧ください。

WP7 ListPicker の操作

于 2012-04-28T15:07:43.377 に答える